130 likes | 232 Views
Emulating the Nintendo Entertainment System. By Danny Matthews Supervised by Dr Des Watson. Background. Emulation. Executed on. Executed on. 8 Bit console released in 1983 60 Million Units Sold Over 1000 Released Titles Major Player in Revitalising the Market After the Crash of 1983.
E N D
Emulating the Nintendo Entertainment System By Danny Matthews Supervised by Dr Des Watson
Background Emulation Executed on Executed on • 8 Bit console released in 1983 • 60 Million Units Sold • Over 1000 Released Titles • Major Player in Revitalising the Market After the Crash of 1983 NES Software NES Emulator Executes on Executed on Executed on “A very precise form of simulation which enables one type of computer to operate as if it were a different type of computer.” - BCS NES
Project Overview • NES • Four Main Units • Central Processing Unit (CPU) • Picture Processing Unit (PPU) • Audio Processing Unit (APU) • Input • Development Tools • Debugger • Name Table Viewer • Pattern Table Viewer Implemented using Java 1.5
Central Processing Unit (CPU) • 2A0X – A Modified 6502 Processor • Minus Binary Coded Decimal (BCD) mode • Plus 22 Memory Mapped Registers CPU Implementation • Implemented as a large switch/case construct • Memory divided into several objects to reflect the varied read/write • behaviour.
Picture Processing Unit (PPU) Pattern Tables Name Tables Images Sprites Sprites
Picture Processing Unit (PPU) PPU Implementation • In contrast to the CPU, Memory stored as primitive integer • arrays • Additional structure unnecessary as read/write behaviour • largely identical for all memory. • Colour Palette handled within its own class. • Provides extremely accurate NES colours through use of a • mathematical algorithm. • Provides alterable hue and tint to emulate TV colour • adjustment • Algorithm devised by Kevin Horton, implemented by • David de Niese
Audio Processing Unit (APU) Pulse (x2) Triangle Noise DMC
Audio Processing Unit (APU) Triangle Mixer Pulse 1 Pulse 2 Mixer Analogue Signal Noise DMC Sound Implementation • Designed to mirror the NES APU • structure. • Down-sampling required to output • sound at 44100 hz as NES outputs • samples at ~1789772 hz. • Volume Control
Input Standard Controller • Movement in Four Directions • Two “Action” buttons • Two “Control” Buttons Movement “Control” “Action” Input Implementation • Button states stored within an 8 bit register • Listenersused to detect button presses and releases • Program reads the button states from the pads periodically • User definable button mapping
Development Tools Memory Viewer CPU Memory PPU Memory Debugger Disassembler System State CPU Registers PPU Registers PPU State Breakpoint System Interrupt Points Register Value Points Step/Resume Functionality
Development Tools Debugger Implementation • System State and Memory Viewer implemented • via the manipulation of data obtained using • accessor methods in the CPU and PPU. • Disassembler implemented via use of an opcode • information lookup table. • Index into the table via opcode number • Retrieve pertinent information for opcode. • Advance forward in file by length of opcode in bytes. • Breakpoints added to and removed from a handler. • Handler checks all breakpoint conditions each • instruction.
Development Tools • Pattern Table Viewer Name Table Viewer Tile and Palette Information Pattern Tables Name Tables Scroll Lines Display Options Palettes Display Options Attribute Table Information
The Software in Action Graphical Auditory