
The Polygons of Another World: Super Nintendo - ingve
http://fabiensanglard.net/another_world_polygons_SNES/index.html
======
RetroSpark
"The DMA registers [...] run the full CPU 3.6Mhz speed. [...] I put a 32 byte
function that would draw a scanline of polygon data in there."

The SNES supports SlowROM and FastROM but, interestingly, its internal memory
is "SlowRAM". This seems like it would significantly bottleneck the system's
performance. I guess "FastRAM" was just too expensive.

 _Another World_ uses SlowROM, so almost everything in the system is slow.
It's a clever trick to use the DMA registers as a tiny amount of "FastRAM" and
run code from there.

Something similar has been done on the Game Boy Advance - it's faster to run
code out of Video RAM than directly from ROM or (the majority of) normal RAM.

~~~
byuu
What's annoying about that memory space is it's fragmented: $4300-437f is the
128-byte region for DMA registers, but $43xc-f aren't usable (well, $43xf
mirrors $43xb for whatever reason. $43xc-$43xe are open bus.)

So basically every 12 bytes, you get 4 bytes that are no longer usable before
the next 12 bytes.

I haven't actually looked at this game's code, but it's certainly clever if
the author found a way to avoid having to perform unconditional jumps in there
that would sacrifice most of the gains in performance.

~~~
RetroSpark
I used a debugger - it looks like the function in the DMA registers is
actually just 32 _bits_ :

    
    
      $4317 mvn src,dest
      $431a rts
    

Each of `src` and `dest` is either $7e or $7f, so this code performs a RAM-to-
RAM memcpy.

~~~
byuu
Okay, a) that's very clever, but b) mvn is really quite slow. DMA would be
faster (presuming the data is on two separate buses, you can't perform RAM ->
RAM DMAs.) Barring that, a manually unrolled loop in a slow memory area would
definitely beat out an mvn in a fast memory area.

I guess it's easy to judge this 25 years later with all we know now. That was
a very cool idea to have implemented back then! Putting the mvn there would
definitely be a boost compared to having the mvn be in a slow ROM area (6
master clock cycles per byte transferred.)

------
xtracto
Loved this... I laughed at the section when the developer goes all the way to
scavenge an FX chip from starfox, solders it to their game, and writes the
appropriate code for it... just gor the boss dismiss it in 5 seconds because
of the cost. It is 2020 and I have experienced the same time and time again. I
a am sure the developer got a thrill of the tech challenge at the time at
least.

~~~
__rvnykk
I'd recommend anyone watch Becky's video¹ on the development, she had to
basically redo it three times! Boss kept demanding more with less hardware.
She's active on twitter too, I'm sure you'll see her discussing this article
there too²

She also did the 3DO and Apple IIgs ports

1\.
[https://www.youtube.com/watch?v=tiq0OL8rzso](https://www.youtube.com/watch?v=tiq0OL8rzso)

2\. [https://twitter.com/burgerbecky](https://twitter.com/burgerbecky)

------
kragen
Holy shit, she had to copy code into the DMA control registers to get it to
blit fast enough. Which meant she had to fit the blit routine into 32 bytes.
That's fucking hard core.

------
ekianjo
I did not realize there was such a gap in resolution between the Amiga version
and the SNES one. When you compare at the end of the article it is almost
light and day!

------
redwoolf
I wonder if this game will ever stop captivating those of us who played it
when it first came out.

------
colejohnson66
> The SNES's CPU name sounds esoteric but the Ricoh 5A22 is in fact a 6502 on
> steroids.

Correct me if I’m wrong, but isn’t it more a 65C816 than a 6502? Granted, the
65C816 was a better 6502, but IIRC, it’s closer to the former than the 6502.

~~~
grawprog
The 65C816 had full backwards compatibility with the 6502 and starts in
emulation mode after a reset making it essentially identical to the 6502 until
switched to native mode. Even in native.mode it retains a lot of backwards
compatibility with the 6502.

[https://en.m.wikipedia.org/wiki/WDC_65C816](https://en.m.wikipedia.org/wiki/WDC_65C816)

~~~
PaulHoule
That is a nice chip.

It has the same 24-bit address space as the early IBM 360 mainframes, the
80286 and a handful of other systems. It's much less cramped than the 16-bit
environment of the 6502, the PDP-11, etc.

It's easy to underestimate the 6052 because other chips (the 68k) series are
better on paper. However, interrupt handling is fast and DMA efficient so it
is a good match to the family computer role.

Apple thought that the Apple ][ would be rapidly out of date so it rushed
ahead with the failed Apple ///, the Lisa, Macintosh, etc. They did not
realize the ][ was going to last as long as it did, otherwise they would have
prioritized the Apple 2gs -- rather than the Mac which had two near-death
experiences before the company became the leader in mobile.

------
zozbot234
You might want to read about the Genesis/MegaDrive version for additional
context
[http://fabiensanglard.net/another_world_polygons_Genesis/ind...](http://fabiensanglard.net/another_world_polygons_Genesis/index.html)
The two systems are broadly similar, especially wrt. their graphics support so
the author seems to skip some things when discussing the SNES.

------
s_Hogg
This is a great read, thanks for posting. Anyone know/care to comment on what
this kind of chicanery looks like in games being made now?

~~~
hirako2000
Back in the days games and ports were solo to tiny teams dev. Now we have what
dozens to hundreds of developers, the chicanery is in management cohorts of
people, politics and all. Boring times in comparison.

~~~
zozbot234
Only AAA games have dozens to hundreds of people involved, independent dev
(gaming or otherwise) is still quite similar to what it was back in the day.

------
jstewartmobile
Atari 400/800, Amiga, SNES--the conductor/orchestra model of system design is
the best.

------
nealabq
This is a popular subject. Previous discussions:
[https://hn.algolia.com/?q=polygons+another+world](https://hn.algolia.com/?q=polygons+another+world)

~~~
0xcde4c3db
Note that "The Polygons of Another World" is an ongoing series, so some
submissions are to the index of the series, while others (like this one) are
to the latest installment at the time, which tends to change the focus of each
discussion.

------
pp19dd
For the nostalgic, SEGA version emulation:
[https://archive.org/details/sg_Another_World_1992_Delphine_V...](https://archive.org/details/sg_Another_World_1992_Delphine_Virgin_EU_en)

------
beloch
I'd really appreciate a comparison of how the sound was done. Although the
SNES could not match the resolution of the Amiga, for my money OoTW sounds a
_lot_ better on the SNES.

~~~
throwaway2048
From a hardware overview perspective, the Amiga's sound chip was essentially 4
"dumb" 8 bit PCM channels, so audio effects and synth stuff was fundamentally
CPU driven, and I'm guessing most of the CPU horsepower was going into the 3d
rendering, without much left over for sound.

The SNES has a completely separate audio subsystem, with 8 16bit PCM channels,
with its own CPU and RAM purely dedicated to sound generation.

------
TazeTSchnitzel
> Hunga Hunga Ohana mascot, do you speak Japanese? I do!

That's… not English she's speaking there. I think it was something containing
「日本語をわかりますか」 but would have to check the video again.

~~~
fabiensanglard
Yea, I used youtube transcript because I don't speak japanese. Or english much
either. If you find out what she meant plese tell me and i will fix the
article.

~~~
an_ko
I checked the video
([https://youtu.be/tiq0OL8rzso?t=925](https://youtu.be/tiq0OL8rzso?t=925) at
15:25): She says "日本語を話しますか？", pronounced "Nihongo wo hanashimasuka?" meaning
"Do you speak Japanese?", which she also translates for the audience in
English immediately afterward.

Edit: Typo.

~~~
fabiensanglard
Thanks for the explanation, I have updated the article and credited you at the
bottom as an_ko@news.ycombinator.com

------
plerpin
A wonderful tale of clever engineering under hard constraints.

------
ekianjo
Fabien, do you plan to write about the 3do version of the game? It was a
completely different port as far as I remember.

EDIT. I suspect Burger also did the 3do port, by the way.

~~~
fabiensanglard
Yes she did.

Unsure about the 3DO port, probably not. I am juggling pet projects right now.
If I ever look at an other version I would go first for the GBA since the
author sent me the source code and it will be easier to look at.

Maybe someone else will do the 3DO analysis? With an emulator it is not hard
to look at how it works.

~~~
ekianjo
You can try Freedo to emulate the 3do version I think.

------
growlist
I always loved this game on Amiga. Flashback too.

------
atum47
you will laugh about, but I played this game when I was a kid on my PC, but I
only finished it years later when I bought a N-Gage (I really miss that phone)

------
otikik
Wow I am impressed by this person. Thanks for sharing!

