The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged

53

The 8 bit 6502 family doesn't have any stack-relative addressing modes that would make it easy to use the stack for variable storage. One can access values on the stack with a sequence such as TSX; LDA &102, X, but that's slower, clobbers X, and uses more memory (both in code size and stack usage) than a global variable. The 65C816 adds stack-relative ...


48

Off the top of my head I can think of two reasons, there are probably more. The first reason is that these variables may be set by a routine each frame, and then a lot of code uses them during the time of the whole frame. Every interrupt routine that fires during that frame may want to read out the current direction. The second reason is that, in a real-...


24

There's something of a conflation here of antialiasing and filtering, I think. Antialiasing is literally preventing things from adopting aliases — e.g. if a diagonal line looks like a staircase rather than a diagonal line, it has adopted an alias. So you can imagine the same thing happening to textures as they rotate or take awkward angles. But it's always ...


23

As mentioned previously the timing issue is the cause not to waste time in pushing up parameters, access them with cost-intensive addressing modes and pull them finally from stack. Too much action if this occurs in a tight, time-critical frame building routine. In a games of a certain size usually all could be handled with global variables. Some state of the ...


22

This is a “write-twice” register, a 16-bit register mapped into a single byte, which takes two 8-bit stores to populate. There are a number of these on the SNES, with varying write orders (high or low byte first). The Super Famicom Development Wiki describes the behaviour of this particular family of registers thus: Note that these are "write twice" ...


22

Yes, they can deplete. More modern games (starting with the Nintendo 64, for instance) used EEPROM (similar to flash memory) so don't have this issue, but in the days of the SNES this was too expensive so battery-backed SRAM was used. How long the batteries last depends on the game. Pokemon Silver for example has a real-time clock, which takes a lot more ...


21

For an emulator to be "cycle accurate" means the interactions between the components are timed accurately enough so that the emulation behaves the same way as the original machine for any given input. I mean "input" in the general sense -- both external inputs such as keyboards, joysticks, buttons, etc. and the program (or programs) being run, the data ...


19

SNES cartridges equipped with the Super FX processor use significantly more power than normal game cartridges. If a Super FX game is used with special controllers or accessories, which can use more power than normal controllers, it is possible to overload the stock AC adapter. As such, with limited exceptions, Super FX games must check the accessories ...


14

It's also worth pointing out that the intricacies of maintaining variables on the stack can result in slower code. And of course there are limits to how big the stack can be; even with the more expansive stack on the 65816, you're still limited to a fraction of bank $00 (so 64K minus the direct page(s) minus any other stacks you have around minus any I/O ...


14

Did Nintendo really change their mind about using the 68000? Hard to say, as these decisions were never public. If so, how does this square with that CPU being so cheap even two years before the launch of the new console? Maybe because the price of the CPU drops to almost zero when using the 65816 as IP. After all, they didn't use the stock CPU, but had ...


12

The Super NES (SNES) has a much different hardware architecture than the Sega Genesis, and is built around the custom Ricoh 5A22 ASIC. As opposed to the discrete, stock, Motorola 68000 CPU employed in the Sega Genesis/MegaDrive, the SNES ASIC contains multiple components that internally operate at different clock speeds. The ASIC has the 65C816 CPU core, ...


12

The main tasks were: Emulation of a bitmap framebuffer for the SNES. The SNES is tile-based, which means plotting arbitrary lines, polygons etc. and filling them with color or a pattern isn't easy. The Super FX had enough RAM on the cartridge to use it as a framebuffer, and it can then DMA transfer it to the SNES video RAM. Faster 16-bit math operations, ...


12

I used to use a clean rubber eraser to clean golden contacts in general, not only cartridges but that can also leave residues if you don't clean it properly after. There is a comprehensive article on Arstechnica website that recommends using Q-Tips, Brass polish, high-concentrated alcohol, and lint-free cloths. Based on the instructions and the companion ...


10

Another example in the tightly constrained world of games - especially those with a real-time loop (e.g., for updating the display on a fixed schedule): there was no space for a "task queue" and/or no time for a "rendezvous" mechanism that would enable data to be passed from one thread to another in one of the "structured" methods that would be more common ...


10

There is a tool called the Super UFO Pro 8 which claims to bypass the region lock, among other things. Unsure if it is only for North American consoles... You can also use a Game Genie or T-Connector in passthrough mode. I was recently researching a similar tool for the Famicom called the FC Pro Action Rocky which can bypass the region lock on the ...


10

Code written in high-level languages do a lot of stack-relative operations, because compilers are good at keeping track of which stack offset refers to which variable in the current context. In hand-written assembly code it was often more common to store things as 'globals' in well-known memory locations, just because it's easier for humans to think about ...


9

[not a complete answer, but some remarks too big for a comment] [also it focuses on games, as they are the most complex, real time application. Antialiasing for desktop UI and editors are a fairly insensitive issue and a subset thereof] Need for Colours A point, often forgotten from today's view is that antialiasing does need a video system systems with ...


8

JSR works how you think — the program counter will head off to 80fa — but the SNES doesn't. The two most common memory mappers both mirror what's at $00xx at $80xx. So when the processor reads from $80fa it gets the same thing as if it read from $00fa. Per the linked article, in a 'HiROM' (i.e. one of the two common types): Banks $80 - $FF can also be ...


8

Depending on the platform we're talking about, you've got a few choices. As the best platform for editing images at the time was the Amiga with its 4096 color palette in HAM mode on OCS/ECS (Original ChipSet/Enhanced ChipSet), and even better modes if you had an AGA (Advanced Graphics Architecture) machine, I'll talk about this computer. The best choice on ...


8

Electrically, the American Super NES and Super Famicom cartridge ports are the same. Their Checking Integrated Circuits (CIC) use the same random number generation key, but they use a differently shaped cartridge housing. American Super NES Game Paks are more squarish and wider than Super Famicom cassettes but include two notches for alignment tabs in the ...


7

Why aren't each pixel's bits stored sequentially on the SNES? Well, to start with, they are always (!) 8 pixels sequentially within a byte - and multiple byte in parallel for extended colour depth. Why? TL;DR: Because it simplifies hardware when multiple colour depth is handled. Why are graphics stored this way when, if each bit of a pixel was stored ...


6

I am thinking of collecting Super Famicon/SNES games but one thing holding me back is the integrity of the cartridges. There must be two grades to the collecting: (1) collecting original hardware and (2) collecting original hardware which functions. How long will the console itself last before it is beyond repair? As you already said it is mostly ...


6

It's usually not as centralised as you describe. If a system supports a background and, say, four sprites then there'll be one part of the video chip that generates the background. That's always running. Then there'll be four distinct shift registers, each responsible for a single sprite. They're also always running. The five outputs go simultaneously to a ...


6

The possible signal lag introduced due to pure cable length is definitely neglectible due to the signals travelling at (close to, for any practical purposes) the speed of light through the cable. What can possibly happen though, and is a much more important practical problem on digital signal lines are problems due to Changed input impedance of the line ...


6

As RichF already mentioned, it's a 16-bit register, which means there are two 8-bit values needed. Usually such a register would be mapped into two addresses. The NES is a bit special here, as it only uses one memory address which results in the need of two consecutive writes with the same address (*1). The tutorial shows an example by setting the ...


6

This was in no way part of a hardware assisted 3D pipeline, but there were attempts made in PC-class hardware to achieve anti-aliasing even as early as 1990. Edsun Labs made a drop in replacement RAMDAC for VGA boards that used some of the 256 possible color values as opcodes that would enable color blending between pixels on a line. This let a nominally ...


5

Some game cartridges such as the NES and SNES Zelda included a way to save your game. This was typically done using a lithium button cell to power memory chips inside the cartridge. The battery has a lifespan of about five years, but the battery can also leak which has the potential to spread down the battery leads and into the circuit board, eating away at ...


5

It's an issue of integration. On the early Genesis systems the custom chips and CPU were physically separate from each other so it was easy to isolate the various clock signals and replace the CPU with a part rated for faster operation. The SNES has a more tightly integrated design where an ASIC contains both the CPU and other components, making it harder ...


5

Of course, there are many ways in which this could be implemented. So the question is most interesting if we consider the earliest usage for Gradius on the NES. For an 8-bit console like the NES, the programmer would take into account both execution and space efficiency. The algorithm is trivially implemented using only two bytes of RAM and some simple ...


Only top voted, non community-wiki answers of a minimum length are eligible