glitchNES - Bent Fest workshop
-
Upload
nocarrier -
Category
Self Improvement
-
view
8.091 -
download
0
description
Transcript of glitchNES - Bent Fest workshop
glitchNES – Soft Circuit Bending on the NES
Bent Festival 2009Don Miller / NO CARRIER
Introduction
About me Introduction to NES graphics
› NES Background Information› NES PPU (Picture Processing Unit)
glitchNES› Lots of subtopics
The NES CPU core is based on the 6502 processor and runs at approximately 1.79 MHz (1.66 MHz in a PAL NES).
In the NTSC NES, the RP2A03 chip contains the CPU and APU; in the PAL NES, the CPU and APU are contained within the RP2A07 chip.
The PPU (Picture Processing Unit), more specifically known as Ricoh RP2C02 (NTSC version) / RP2C07 (PAL version), is the microprocessor in the NES responsible for generating video signals from graphic data stored in memory.
The chip is known for its effective use of memory, using very little memory to store graphical data.
It was rather advanced for its time when the Famicom (Japanese version of the NES) was released, sporting full sprite support, movable backgrounds, and many colors on screen at the same time.
Picture resolution of 256 × 240 pixels (fully visible on PAL, but cropped to 256 × 224 on most NTSC television sets)
2KB external RAM for graphics information storage Up to 64 sprites (movable objects) on screen
simultaneously (only 8 visible per scan line) 256 bytes for sprite data storage 8 × 8 or 8 × 16 (selectable) sized sprite tiles Two 4KB tile sets with space for 256 tiles each 32 bytes for palette storage 25 colors simultaneously from a hardware color
palette of 64 colors
Picture resolution of 256 × 240 pixels
The NES screen is made of 8x8 pixel background tiles.
That means the NES screen is 32x30 tiles.
The magic number: 32 * 30 = 960.
2KB external RAM for graphics information storage
The NES has four nametables, arranged in a 2x2 pattern.
Each occupies a 1 KB chunk of PPU address space, starting at $2000 at the top left, $2400 at the top right, $2800 at the bottom left, and $2C00 at the bottom right.
$2000 $2400
$2800 $2C00
2KB external RAM for graphics information storage
Each byte in the nametable controls one 8x8 pixel character cell.
Each nametable has 32 tiles across and 30 tiles down, for a total of 960 ($3C0) bytes.
The rest is used by each nametable's attribute table (960 + 64 = 1024, or 1KB).
But the NES system board itself has only 2 KB of VRAM, enough for two nametables.
That means that two nametables are mirrored horizontally or vertically.
The Nametables
Load up SMB and Xevious in Nintendulator to view horizontal and vertical nametables
$2000 $2400
$2800 $2C00
Two 4kb tile sets with space for 256 tiles each
Even the most basic NES game (think SMB or Balloon Fight) has 8kb for graphics data storage. 4kb in one tile set, for background 4kb in another tile set, for the sprites
Load up YY-CHR to show SMB / Balloon Fight
32 bytes for palette storage
The NES palette storages used one byte for each color stored. 16 bytes for the background 16 bytes for the sprites
Here is an example of the NES palette:
25 colors simultaneously
The NES palette is 64 total colors. From the 32 colors chosen for background
and sprites, only 25 can be shown simultaneously.
This is because the first color repeats every four colors, and is the transparent/background color.
Example: $0f, $30, $16, $29, $0f, $10, $39, $30
Load up Nintendulator to show 25 color limit
Early games
Early games didn’t use a mapper, and only included a few chips on the main board:
glitchNES – Introduction
Open source software for the NES Produces graphical glitches similar to
hardware circuit bending
glitchNES – Inspiration
NES hardware problems Game Genie noteNdo
glitchNES – How it works
Doing the right things at the wrong times:› Writing while the screen is rendering
Doing things faster than you should be:› Scrolling and other basic techniques
glitchNES – What? Who?
Messing around:› Stable (yes, stable)
code base for your NES projects
› Learning more about 6502 and/or the NES
Live visuals:› Dan Winckler,
Enso, other visualists?
glitchNES – Make it your own
Editing the tiles:› YY-CHR
Editing the code:› 6502 ASM and
included compiler: ASM6 by loopy
glitchNES – Software and Hardware options
NES development cartridge
RetroUSB PowerPak Emulation
glitchNES – Development Cart
Benefits:› Easy to switch out PRG / CHR chips› Easy to do further hardware
bending to supplement glitchNES effects
› Fun / awesome / cool factors
glitchNES – PowerPak
Benefits:› Easy to change tile
sets› Easy to make
multiple copies of the program with different effects
Challenges:› Looks different
than dev cart and emulation
glitchNES – Emulation
Benefits:› Easy to change tile
sets› Easy to make multiple
copies of the program with different effects
Challenges:› Different emulators
provide different results
glitchNES – Software and Hardware options
Let’s take a look…
glitchNES – What’s next
New wiki on my homepage Controller two usage for more effects
› Looped visual effects PowerPad support for further interaction
› Good for live performance Sprites
› Another layer to play with “Music” generated by button presses
› All four channels, maybe even samples
glitchNES – What YOU can do
Submit tile sets / graphics
Submit snippets of code
Submit pictures and videos
Ask questions Make suggestions Have fun
glitchNES – What YOU can do
Let’s edit some tiles and code…
Programs and Compilers
Programs I like to use:› YY-CHR (freeware tile editor)› XVI32 (freeware hex editor)› Pin Eight nametable editor: name.exe› Loopy’s ASM6 compiler (for 6502 ASM
language)› Context (with 6502 ASM highlighter)› Nestopia and Nintendulator (accurate NES
emulators)
More information
NESDEV:› Online: nesdev.parodius.com› IRC: #nesdev on efnet› Wiki: nesdevwiki.org
8bitcollective.com› http://tinyurl.com/d6w47f
Programming the 6502, by Rodney Zaks 6502.org
http://www.no-carrier.com [email protected] (contact me)