Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Sonic the Hedgehog for Commodore 64/128 + REU (lemon64.com)
111 points by adunk on Dec 13, 2021 | hide | past | favorite | 31 comments


Forum seems to be going in and out so here is the YouTube video linked in the post if it's not loading: https://www.youtube.com/watch?v=jGp4a00OeRs



A little background on how this works and why the REU is needed. The C64 has a 1Mhz 8-bit 6510 processor. Its video chip (the VIC ii) displays a 40 column by 25 row screen of customizable characters. That is 1k of memory for the characters which uses a re-locatable 1k block of the system's main 64k memory. There is an additional 1k of nibbles (4bit) memory that gives the color information for the display. This color ram is a separate chip and there is no provision for relocating or double-buffering this memory.

The VIC ii chip provides hardware support for 8 pixels of scroll in the horizontal and vertical directions. To scroll more than 8 pixels the program needs* to modify the screen data and the color ram. The screen data can use a double-buffering approach but color ram must be updated on the fly, using the vblank interval and/or racing the raster beam to update the lower part of the screen memory before it is displayed.

The fastest possible screen update code on a stock C64 is a completely unrolled loop of LDA/STA : load a character value into a register and store that value to the screen ram. That takes 8 clock cycles (fully unrolled) or 9+ clock cycles (partly unrolled). To update 1k addresses of screen data + 1k addresses of color ram takes a theoretical minimum of 16k cycles of processor time, fully unrolled wasting 12k of code space. More realistically for a game this would be partial unrolling and take somewhere over 19k cycles.

A PAL display (Europe) updates at 50 frames per second; a NTSC display (US version) updates at 60 frames per second. In the PAL version that is a maximum 19656 cycles per frame if the display were disabled; with the display enabled and sprites in use the VIC ii "steals" some of the cycles from the processor leaving under 18.5k cycles remaining.

This makes it impossible for a full-framerate game with no additional hardware to do scrolling as fast as this Sonic appears to do. There just are not enough cycles per frame to process the video memory moves, much less carry out any game logic on top.

The Ram Expansion Unit (REU) gives two advantages: one is just to enlarge the storage space of how much memory can be quickly accessed on top of the machine's built-in 64k. This allows larger maps and more game logic to be stored. But the REU has one more feature that is important here: Direct Memory Access (DMA). The REU has the ability to do the same thing the Vic ii chip does: it can "steal" cycles from the processor and use them for memory access. The Vic ii chip only steals cycles to read memory (for screen and sprite display) but the REU can steal cycles to write memory.

The REU's DMA can write sequential memory like in the screen display or color ram at a rate of 1 byte (or color nibble) per cycle. So in contrast to the processor, which requires over 19k cycles to update the whole display memory, the REU can do it in 2k cycles.

But in its era, the REU was an expensive and not widely-owned bit of hardware. No commercial games used this approach for accelerated scrolling.

*there is a hardware trick to cause the VIC ii chip to display a mis-aligned version of the screen data, which allows scrolling by more than 8 pixels with only a fraction of the data updates required. Unfortunately this trick (named Variable Screen Position (VSP) by the demoscene community) causes the VIC ii chip to send out-of-specification signals to the system ram, resulting in memory corruption on a significant percentage of C64's. Thus this approach was also not much used in commercial games releases. [1]

[1] https://www.linusakesson.net/scene/safevsp/index.php


Hey dzdt, will it matter which REU? In other words, would the 128K version be enough for this to be supported or would it need more RAM (e.g. 512kb, etc.)?


The DMA capabilities are present on all versions of REU. Somewhere MrSid said this Sonic game requires 256k of REU; I would assume that is mostly used for level data and extras; 128k should be plenty to handle the unpacked data for scrolling around a single level.


upgrading 1700 REU is trivial https://www.nightfallcrew.com/gallery/commodore-64-ram-expan... http://www.zimmers.net/anonftp/pub/cbm/documents/projects/me...

replace 8 existing chips = 256KB version, replace 8 existing with 16 higher density = 512KB


Way past cool! I guess with Super Mario on the C64, a (8 bit) Sonic port was inevitable. This looks to be a really colorful remake of the Game Gear/SMS version of the game.

Kudos to the developers for this!


Wow, nice! I also want to try the new 3D space exploration game, Gates of the Ancient [0].

(Has anyone remade He-Man yet? It could really use a loving touch of...some sensibility)

Happy C64 holidays everybody...

https://www.youtube.com/watch?v=MTHRU6V54GU

0. https://drmortalwombat.itch.io/gates-of-the-ancient


I think we've had enough He-Man remaking recently, innit?


On the C64? No way. On Netflix? Barely! (Though I've enjoyed watching the new series and its twists)


Are devs somehow cheating at these games made for retro consoles? They look so much nicer than games made during the console's era.


No, but it requires a RAM expansion that was not very affordable in the 80s, costing more than the c64 itself.

Compare to Amstrad CPC Sonic, for a similar 8-bit machine—but only the final and most expensive models.


The hardcore communities today have a few decades extra experience and time to find tricks, that does help with many retro machines.


I have to imagine the development process is a lot better, too. Compile with your 3 GHz processor, launch into it in your emulator… quick feedback loop. (Or maybe this kind of development is still done on the real hardware?)


REU is a bit of a cheat, and for some releases people are using cartridges with far higher capacities than ever sold back in the day. Cross-platform tools and emulation are also huge dev speedups.

But a big thing is that back then, games were often made on a timescale of months, and with a budget. Hobbyist dev has no limits to how much time they want to sink into doing something properly. Ideas & techniques have had many years/decades to percolate into existence.


I believe this requires the RAM expansion unit


which has DMA capability http://www.zimmers.net/anonftp/pub/cbm/documents/chipdata/pr...

1) Transfer a block of data from main memory to expansion memory

2) Transfer a block of data from expansion memory to main memory

3) Exchange a block of main memory with a block of expansion

4) Verify a block of main memory with a block of expansion memory

copy is ~1MB/s compared to manual CPU speed of <120KB/s


I was kind of hoping this was going to be some wonky bootleg, like the original "Super Mario Bros" for the C64, which was actually a resource edited Great Giana Sisters

https://dfarq.homeip.net/super-mario-bros-commodore-64-versi...


Here's your wonky bootleg: https://en.wikipedia.org/wiki/Somari https://www.youtube.com/watch?v=DNRBcjhT2Wc

Sonic The Hegehog. For the NES. And you play as Mario.


I didn't know the C64 had blast processing!

The levels and characters look great, the gameplay pieces are mostly there, and the music at least sounds authentic, if not exactly pleasant. Something was definitely lost in translation there but short of writing new music I don't know what else they could have done.

Great work all around.


Sounds like PAL audio speed. I would have preferred the intended NTSC speed used in the Japanese and American release.


That actually makes a lot of sense, I've only ever played NTSC Sonic. In that case it probably sounds great at the right speed.

Thanks for the insight!

EDIT: In fact watching the video at 1.25x makes the music sound substantially better. I think that's too fast[0], but either way you've nailed the issue I had with it. I'm eager to hear it "as intended".

[0]: I listen to podcasts at 3x speed so my sense of the "right" timing for audio has definitely weakened.



There will be an NTSC version as well.


Zero page = blast processing! ;-)


Anyone remember the best mario type clone (Mayham in monsterland). http://www.psytronik.net/newsite/index.php/c64/96-mayhem25


Looks a bit better than the previous attempt https://youtu.be/B1UpBjITF1I


This Sonic Hedgehog character looks suspiciously similar to Mickey Mouse. Wondering if there ever was a lawsuit about it.


This is a joke, but the original concept for Sonic was a character named "Mr. Needlemouse." http://info.sonicretro.org/Mr._Needlemouse


Actually, that’s a popular misconception. The Japanese word for hedgehog is made up of components that transliterate to “needle” and “mouse”, that is true. But the originally intended interpretation was always “Mr. Hedgehog”.

https://twitter.com/sonicjpnews/status/1353289643693895680


Probably not. The characters are very dissimilar and have only one common attribute:

Differences:

- Mickey Mouse has small eyes, Sonic has big eyes.

- Sonic is blue, Mickey Mouse is black.

- Sonic has spiked hair, Mickey Mouse has big ears.

- Sonic has red pointy shoes, Mickey Mouse has yellow round shoes.

- Sonic has no shorts, Mickey Mouse has red shorts.

- Mickey Mouse has a mouse tail, Sonic has a stubby hedgehog tail.

- Sonic wears socks, not Mickey.

The only thing that's common is the fact both have white gloves.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: