top | item 28100428

What it was like developing for NES back in 1990

230 points| _Microft | 4 years ago |twitter.com

60 comments

order
[+] yosser|4 years ago|reply
One of the trickier things to manage on a NES (without additional hardware on the cartridge) was maintaining a static information panel on the bottom of the display - for the score and so forth - while the portion of the display devoted to gameplay scrolled freely around both vertically and horizontally.

The trick we used at Zippo (Wizard and Warriors II and 3, Solar Jetman etc.) a trick given to us by Rare, was to change the scroll registers and I think the character look up location at the moment the screen refresh cycle reached the appropriate point on the display. These registers would then need to be reset during the vertical blanking interval. So all in all either 100 or 120 times a second depending on the TV system.

Since we couldn't afford to keep the CPU hanging around doing nothing while we waited for the cathode ray tube gun to hit the right point on the screen the trick was a two parter.

First you would get the sound chip - such as it was - to play an inaudible sample of a determined length which would then trigger a CPU interrupt at more or less the right time, within say two or three scanlines of the position of our static panel. You would then position a spare sprite on top of a visible pixel at precisely the right point on the screen so that when it flipped its hardware collision detection bit this was precisely the right time to switch the scroll registers etc.

These were the kinds of shenanigans that made programming the NES intricate and time consuming, and also in later years I suspect made the job of emulator writers something of a misery.

[+] matheusmoreira|4 years ago|reply
> also in later years I suspect made the job of emulator writers something of a misery

Most certainly. These tricks force developers to emulate systems down to individual cycles in order to get the timing right because getting them wrong will result in visual glitches or worse.

https://mgba.io/2017/04/30/emulation-accuracy/

https://mgba.io/2017/07/31/holy-grail-bugs-2/

Byuu, the author of bsnes, wrote some very detailed articles about this as well. I can't seem to find them anymore though. His domain has also been excluded from the internet archive for some reason.

[+] crmrc114|4 years ago|reply
Your post is why I keep coming back to HN to read- thank you so much for sharing. I love the undocumented stories from the trenches.
[+] anyfoo|4 years ago|reply
> was to change the scroll registers and I think the character look up location at the moment the screen refresh cycle reached the appropriate point on the display. These registers would then need to be reset during the vertical blanking interval. So all in all either 100 or 120 times a second depending on the TV system.

That's a cool way to do it on the NES. While the NES did not have a raster interrupt, requiring such tricks (though you mentioned the later cartridges with the extra chip that added one), the Game Boy did have a raster interrupt, and the SNES essentially went all in on it. Switching the mode mid-frame became a very common method then.

By the way, PAL/NTSC is 50/60Hz, but a frame consists of two fields (odd/even lines), so 25 or 30 frames per second for PAL/NTSC respectively. So I guess this means you probably did the trick 50/60 times per second? (Unless you used more than two configs per frame maybe.)

[+] 0des|4 years ago|reply
When I hear stories like these, I always think that nobody is doing stuff like this these days; but in retrospect, I think it's just that I've never asked or seen it discussed.. so..

What are you guys doing these days that has this same hacker-ethos applied to it?

[+] phoboslab|4 years ago|reply
Very cool! Sounds a lot like all the tricks you had to employ for the Atari 2600. If someone is interested in this, I can highly recommend the book "Racing The Beam". It's hard to imagine these days how complicated even the simplest things were back then.

15 years back I did some hobbyist programming for the GameBoy. Drawing a status bar there was comparatively easy. The hardware allowed you to set some registers to define a "window region", overlaying the main background map.

[+] ant6n|4 years ago|reply
No hblank interrupts? Game boy has them to make this sort of thing relatively easy. Hblank interrupts is also how "mode7" style pseudo 3d for a Mario kart style game can be made (on GBA or SNES).
[+] agumonkey|4 years ago|reply
man it must have been such a weird era where the screen was part of the "system architecture"

today everything seems so decoupled

[+] psyc|4 years ago|reply
What mechanism existed for telling what scan line the TV was on?
[+] chrismcb|4 years ago|reply
You meant 50 or 60 times a second. SNES wasnt that fast. And yeah what you were describing was common
[+] Kye|4 years ago|reply
Was this any less harrowing than racing the beam on an Atari 2600?
[+] sircastor|4 years ago|reply
I wrote an NES game as my senior project for college. It was a singular experience as the vast majority of my development experience had been web technologies.

I had the advantage of full-featured emulators, breakpoints, examining the code as it was running, and a very searchable community online. I have sometimes pondered on the challenges of writing 6502 assembly without any of these things. It’s really interesting to see some of what that was.

[+] djmips|4 years ago|reply
It certainly is so much easier to get documentation or read forum posts and ask questions today. Back then, we did have fairly decent dev systems though, could do breakpoints and examine code as it was running. It was also cross-development so you could edit and download from your computer onto the dev system attached to the console. To be fair, some people had much more primitive systems, I feel lucky since others could only test by burning EPROMs.
[+] _Microft|4 years ago|reply
From the title screen of the tool:

"The current version still has room for improvement and any suggestions will be listened too[sic!], and probably ignored."

Good to know that it was never any different ;)

[+] nom|4 years ago|reply
Does anyone know how it is done today, like with Micro Mages?

https://youtu.be/ZWQ0591PAxM

[+] dormento|4 years ago|reply
I do it in C (good enough for most purposes, although a little slow and bloated - most people do it straigh in ASM with extensions).

I use Ubuntu, good old Sublime Text with C extension, FCEUX (Windows version on wine) and YY_CHR (for working with graphics). To compile, check out the awesome CC65 suite (it has a compiler, assembler, linker... the whole thing).

[+] sircastor|4 years ago|reply
I used an emulator called NinTaco, a 6502 assembler, and VS Code. My game was very simple and completed in about 3 months (I didn’t have any sound and a very limited game)

I think the crucial piece is the assembler and documentation about the start up and loop processes.

[+] alkonaut|4 years ago|reply
What's the reason for using ASM? Were there no good compilers for higher level languages (like C) available for the platform, or were the developers simply accustomed to using ASM, or was the platform limitations such that developers simply had to use ASM?
[+] dan_hawkins|4 years ago|reply
6502 is just not that viable for C-like languages. Mostly because of its tiny hardcoded stack, so for C you need to either emulate the stack in software (slow) or figure out workarounds (mostly involving precious zero page.)
[+] TillE|4 years ago|reply
NES games were still pretty simple, so I can see how simple tools were more or less adequate.

I'm far more impressed that complex SNES games were also developed purely in assembly, like A Link to the Past (1991) or Super Metroid (1994). This is an era where PC game developers would mostly be using C.

[+] emsy|4 years ago|reply
SMB3 will outshine a lot of games released today and I think that’s a good thing. Great game design is somewhat timeless.
[+] anyfoo|4 years ago|reply
On the other hand, there were pretty complex games on the vastly more simple NES. Less than on the SNES, they required elaborate tricks. (I guess that however mostly required more from the actual game code, and sometimes some extra hardware, than from the tools.)