I am a turncoat. A simple sprite demo for Sega Master System

Discussion of development of software for any "obsolete" computer or video game system.
turboxray
Posts: 104
Joined: Thu Oct 31, 2019 12:56 am

Re: I am a turncoat. A simple sprite demo for Sega Master System

Post by turboxray » Fri Dec 20, 2019 9:09 am

Drag wrote:
Thu Dec 19, 2019 8:05 pm
I never knew the SMS had these kinds of limitations (I only knew about the lack of sprite flipping), and it really makes me appreciate what the NES afforded its developers. Now I want to go back and see how certain games (like the SMS Sonic and Mickey Mouse games) handle their vram.
Honestly, they're pretty minor especially considering its strengths.

Homebrew games look pretty decent on the SMS:
https://www.youtube.com/watch?v=Kh44aAiiyBg
https://www.youtube.com/watch?v=6xQ6xgT ... 6AnLqX1x97
https://www.youtube.com/watch?v=M6PPIt2 ... 97&index=2
https://www.youtube.com/watch?v=zMnv-sx ... e=emb_logo
https://www.youtube.com/watch?v=G8PFfYtRALk
https://www.youtube.com/watch?v=CoXBR5jaUko

SMS VDP allowed for an impressive version of Gauntlet too. It has some cool tricks it can pull off.

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

Re: I am a turncoat. A simple sprite demo for Sega Master System

Post by tepples » Fri Dec 20, 2019 11:27 am

How is the vertical scrolling accomplished in this part of the Gradius II port? The status bar is too wide to be sprites. Is it pixel-wise counter-scrolling on the other tilemap?

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

Re: I am a turncoat. A simple sprite demo for Sega Master System

Post by TmEE » Fri Dec 20, 2019 11:36 am

Only way I can think of is to switch to TMS modes since they cannot be scrolled and always appear in fixed location on the screen.

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

Re: I am a turncoat. A simple sprite demo for Sega Master System

Post by tepples » Fri Dec 20, 2019 11:49 am

The Genesis with a Power Base Converter does not support TMS9918 modes. Should developers of SMS games be concerned about PBC compatibility?

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

Re: I am a turncoat. A simple sprite demo for Sega Master System

Post by TmEE » Fri Dec 20, 2019 11:52 am

My "flagship" SMS project won't even work on JP SMS due to limited cartslot of the platform compared to US/EU machine, I am not concerned at all about lack of MD compatibility. The people who are going to play the game have SMS anyway.

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

Re: I am a turncoat. A simple sprite demo for Sega Master System

Post by lidnariq » Fri Dec 20, 2019 12:16 pm

Looking in the GG game Sylvan Tale, it uses two nametables, and dynamically renders the status bar at the bottom of the 2nd nametable, taking advantage of being able to adjust X scrolling on every scanline.

Drag
Posts: 1322
Joined: Mon Sep 27, 2004 2:57 pm
Contact:

Re: I am a turncoat. A simple sprite demo for Sega Master System

Post by Drag » Fri Dec 20, 2019 8:40 pm

Thank you for sharing, of those, Pigarus is my favorite. :D

I did notice some patterns though, like these are all shooters, a genre which benefits from constant-speed scrolling on one axis (you can stream new tile bitmaps in as it scrolls in a predictable way), and from enemy waves which are groups of one enemy type at a time (only need to have graphics for one type of enemy ship loaded in memory per wave). I don't know if this is what's going on, but these are the first ideas that come to mind.

Sorry to say, I do appreciate the importance and impressiveness of demos like Bad Apple, but I just don't get that excited over it compared to seeing a game demo. Maybe it's the Sega CD effect. ;)

turboxray
Posts: 104
Joined: Thu Oct 31, 2019 12:56 am

Re: I am a turncoat. A simple sprite demo for Sega Master System

Post by turboxray » Fri Dec 20, 2019 10:58 pm

Drag wrote:
Fri Dec 20, 2019 8:40 pm
I did notice some patterns though, like these are all shooters, a genre which benefits from constant-speed scrolling on one axis (you can stream new tile bitmaps in as it scrolls in a predictable way), and from enemy waves which are groups of one enemy type at a time (only need to have graphics for one type of enemy ship loaded in memory per wave). I don't know if this is what's going on, but these are the first ideas that come to mind.
You'd have to look with an SMS debugger. For Pigarus, it looks more like they're trying to maximize colors on screen by focusing those 15 colors of the sprite palette per group. The BG can use both 16 color BG palette and the 15 color sprite palette, but the sprites are limited to just itself. The SMS also has less overall total 8x8 cells, because the tilemap takes up 64 cell space in vram and SAT (OAM) takes up 8 cells. But BG cells can use sprite cells and has full access to all 512 total cells in VRAM (including the tilemap and sat area). Sprite cells behave more like NES; 256 for 8x8 and 512 if 8x16, and there's a bit in the register settings indicating what half of vram the sprite cells originate (for 8x8 mode).

So little less over all cells, but the BG has access to more cells for more detail (and also includes H/V flipping).

But yeah, my guess would be because they're trying to maximize color Pigarus because the enemies are simple and their should be enough sprite cells for more than one type at a time. To what tokumaru was mentioning; the bells in twinbee have up to 5 different colors for the sprites, so that means they need 5 copies of it in vram (pretty sure they're 16x16 pixels). But then again, that homebrew (and the musha one) looks miles ahead of anything on the NES. Too bad the SMS never got a sound upgrade chip (out side japan with the FM module). That sound chip is rough haha.
Sorry to say, I do appreciate the importance and impressiveness of demos like Bad Apple, but I just don't get that excited over it compared to seeing a game demo. Maybe it's the Sega CD effect. ;)
Yeah, same. It's just a nice indication of vram bandwidth check on the system (remember, it has no mapable chr-rom or chr-ram).

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

Re: I am a turncoat. A simple sprite demo for Sega Master System

Post by tepples » Fri Dec 20, 2019 11:12 pm

"constant-speed scrolling on one axis" also describes something like HH85 or any other ratchet-scrolling platformer, as you're just pausing and unpausing the scroll.

Tech demos in the vein of "Bad Apple" serve a purpose. If you can do near-full-screen color FMV at 12 fps, then with enough ROM, you can do a 16- or 32-frame loop and make a rail shooter with a prerendered background. Compare Cube Quest for LaserDisc arcade (whose location tests led to the Polybius myth) or Iridion 3D for GBA.

As for needing to keep five different 16x16-pixel bells loaded for the five different palette swaps: How often do they change cel? If not often, it becomes practical to stream the cels into VRAM.

turboxray
Posts: 104
Joined: Thu Oct 31, 2019 12:56 am

Re: I am a turncoat. A simple sprite demo for Sega Master System

Post by turboxray » Sat Dec 21, 2019 6:32 am

tepples wrote:
Fri Dec 20, 2019 11:12 pm
Tech demos in the vein of "Bad Apple" serve a purpose. If you can do near-full-screen color FMV at 12 fps, then with enough ROM, you can do a 16- or 32-frame loop and make a rail shooter with a prerendered background. Compare Cube Quest for LaserDisc arcade (whose location tests led to the Polybius myth) or Iridion 3D for GBA.
I was wondering that too. I mean given the H/V flip and more than 256 tiles for BG, you could do a 120x96 area mirrored for 180 cells. With 360 cells, that's enough for double buffering and still have cells left over for sprites. I'm not sure what the maximum bandwidth to vram is (via the cpu). I'd imagine PAL with 192 vertical res mode has a nice chunk of vblank though.

For the bells, there's a point in the video where all 5 colored bells are shown on screen at once.. so 5 * 16x16 = 20 cells. That's not too terrible I guess, but I would have opted for three haha.

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

Re: I am a turncoat. A simple sprite demo for Sega Master System

Post by tepples » Sat Dec 21, 2019 7:11 am

I've read that the maximum write speed during draw is 1 write every 26 cycles, and the maximum during vertical or forced blanking is as fast as the Z80 can push (one every 16 cycles for unrolled outi). There are 228 cycles in each line.

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

Re: I am a turncoat. A simple sprite demo for Sega Master System

Post by TmEE » Sat Dec 21, 2019 7:22 am

SMS gives one access slot every 32 pixels during active line (8 total) and 11 more during offscreen parts but they are clustered together and you can only hit couple of them in best case, so at most you can write 11 bytes total.

Code: Select all

SMS VRAM bus is 16 bit but CPU interface is 8 bit so half the bandwidth is
lost due to that. In addition to that, Z80 is too slow to exhaust available
bandwidth during forced blanking and passive scan but it can write data too
fast during active scan causing missed writes and data corruption to happen.

Ideal case access figures for Z80 using OUTI instruction :
+---------+-----------------------+-----------------------+
|         |          50Hz         |          60Hz         |
|         +-------+-------+-------+-------+-------+-------+
|         |  V192 |  V224 |  V240 |  V192 |  V224 |  V240 |
+---------+-------+-------+-------+-------+-------+-------+
| Active  |  2123 |  2475 |  2651 |  2123 |  2475 |  2640 |
| Passive |  1710 |  1254 |  1026 |   983 |   527 |     0 |
| A + P   |  3833 |  3729 |  3677 |  3106 |  3002 |  2640 |
| Blanked |  4460 |  4460 |  4460 |  3733 |  3733 |  3420 |
+---------+-------+-------+-------+-------+-------+-------+
Number of tiles that can be transferred per frame :
+---------+--------------------+--------------------+
|         |        50Hz        |        60Hz        |
|         +------+------+------+------+------+------+
|         | V192 | V224 | V240 | V192 | V224 | V240 |
+---------+------+------+------+------+------+------+
| Active  |   66 |   77 |   82 |   66 |   77 |   82 |
| Passive |   53 |   39 |   32 |   30 |   16 |    0 |
| A + P   |  119 |  116 |  114 |   97 |   93 |   82 |
| Blanked |  139 |  139 |  139 |  116 |  116 |  106 |
+---------+------+------+------+------+------+------+

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

Re: I am a turncoat. A simple sprite demo for Sega Master System

Post by tepples » Sun Dec 22, 2019 6:39 pm

The timing description by Mask of Destiny in this topic implies that the Z80 gets at least one VRAM access time slot for every 32 pixels. This implies that the rule is "A VRAM write will take effect within the next 22 Z80 cycles. Don't issue another while one is waiting."

Based on that description, I've illustrated SMS VDP access timing, with that of the NES PPU for comparison. Both take two pixels to do a read or write, but rendering-related reads on the SMS VDP are 16 bits wide.
sms_vs_nes_render_timing.png
sms_vs_nes_render_timing.png (808 Bytes) Viewed 5842 times

turboxray
Posts: 104
Joined: Thu Oct 31, 2019 12:56 am

Re: I am a turncoat. A simple sprite demo for Sega Master System

Post by turboxray » Mon Dec 23, 2019 10:15 am

Ohh.. what tepples posted reminded me... is the SAT modifiable mid screen?

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

Re: I am a turncoat. A simple sprite demo for Sega Master System

Post by TmEE » Mon Dec 23, 2019 10:17 am

Yes, you can do that. What you do on current line gets to be seen on the next.

Post Reply