glitchnes - bent fest workshop

31
glitchNES – Soft Circuit Bending on the NES Bent Festival 2009 Don Miller / NO CARRIER

Upload: nocarrier

Post on 23-Jan-2015

8.091 views

Category:

Self Improvement


0 download

DESCRIPTION

PPT presentation from my workshop on glitchNES at the 2009 Bent Festival @ The Tank, NYC. glitchNES is an open source software project for the Nintendo Entertainment System. This software causes graphical glitches similar to hardware circuit-bending. The current version is 0.1 (initial release).

TRANSCRIPT

Page 1: glitchNES - Bent Fest workshop

glitchNES – Soft Circuit Bending on the NES

Bent Festival 2009Don Miller / NO CARRIER

Page 2: glitchNES - Bent Fest workshop

Introduction

About me Introduction to NES graphics

› NES Background Information› NES PPU (Picture Processing Unit)

glitchNES› Lots of subtopics

Page 3: glitchNES - Bent Fest workshop

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.

Page 4: glitchNES - Bent Fest workshop

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.

Page 5: glitchNES - Bent Fest workshop
Page 6: glitchNES - Bent Fest workshop

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.

Page 7: glitchNES - Bent Fest workshop

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

Page 8: glitchNES - Bent Fest workshop

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.

Page 9: glitchNES - Bent Fest workshop
Page 10: glitchNES - Bent Fest workshop

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

Page 11: glitchNES - Bent Fest workshop

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.

Page 12: glitchNES - Bent Fest workshop

The Nametables

Load up SMB and Xevious in Nintendulator to view horizontal and vertical nametables

$2000 $2400

$2800 $2C00

Page 13: glitchNES - Bent Fest workshop

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

Page 14: glitchNES - Bent Fest workshop

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:

Page 15: glitchNES - Bent Fest workshop

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

Page 16: glitchNES - Bent Fest workshop

Early games

Early games didn’t use a mapper, and only included a few chips on the main board:

Page 17: glitchNES - Bent Fest workshop

glitchNES – Introduction

Open source software for the NES Produces graphical glitches similar to

hardware circuit bending

Page 18: glitchNES - Bent Fest workshop

glitchNES – Inspiration

NES hardware problems Game Genie noteNdo

Page 19: glitchNES - Bent Fest workshop

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

Page 20: glitchNES - Bent Fest workshop

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?

Page 21: glitchNES - Bent Fest workshop

glitchNES – Make it your own

Editing the tiles:› YY-CHR

Editing the code:› 6502 ASM and

included compiler: ASM6 by loopy

Page 22: glitchNES - Bent Fest workshop

glitchNES – Software and Hardware options

NES development cartridge

RetroUSB PowerPak Emulation

Page 23: glitchNES - Bent Fest workshop

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

Page 24: glitchNES - Bent Fest workshop

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

Page 25: glitchNES - Bent Fest workshop

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

Page 26: glitchNES - Bent Fest workshop

glitchNES – Software and Hardware options

Let’s take a look…

Page 27: glitchNES - Bent Fest workshop

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

Page 28: glitchNES - Bent Fest workshop

glitchNES – What YOU can do

Submit tile sets / graphics

Submit snippets of code

Submit pictures and videos

Ask questions Make suggestions Have fun

Page 29: glitchNES - Bent Fest workshop

glitchNES – What YOU can do

Let’s edit some tiles and code…

Page 30: glitchNES - Bent Fest workshop

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)

Page 31: glitchNES - Bent Fest workshop

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)