nes_coding.git
3 years agoLab 7: Read the controller master
Rhett Aultman [Sun, 2 Aug 2020 20:59:56 +0000 (16:59 -0400)]
Lab 7: Read the controller

Wow!  Real player control!  In this lab, we cover how to strobe and read
the dpad buttons and hook it in to the existing "engine", such as it is,
so that the little character runs forward only when controlled to do so.

The process is easy, involving strobing the button state into a shift
register and reading it back.  There are some pretty standard algorithms
for doing this, but again, the goal of many of these labs is to make
something as plain and readable as possible first.

3 years agoAPU init and audio synthesis
Rhett Aultman [Sun, 2 Aug 2020 20:08:22 +0000 (16:08 -0400)]
APU init and audio synthesis

This lovely new lab shows how to set up the APU registers into a state
suitable for working with the NES audio subsystem.  It also introduces
some of the basics about how to play a sound out of the APU,
specifically the concepts of period, volume, length counters,
step-per-frame counter, etc.

Practically, the little guy now makes a rumbling, huffing noise as he
runs.  And I changed the animation cycle parameters to give him a little
hustle.

4 years agoSlight tweak to lab 5 to make the character move
Rhett Aultman [Sat, 4 Jan 2020 06:04:56 +0000 (01:04 -0500)]
Slight tweak to lab 5 to make the character move

Marching in place isn't nearly as exciting as using the OAM for its
real power, which is moving sprites around the screen, so this is a little
tweak to demonstrate updating the OAM coordinates.

4 years agoAdded Lab 4 and 5 notes
Rhett Aultman [Mon, 30 Dec 2019 15:55:23 +0000 (10:55 -0500)]
Added Lab 4 and 5 notes

Added Lab 4 and 5 notes

5 years agoAnimating sprites
Rhett [Sun, 21 Oct 2018 17:21:57 +0000 (13:21 -0400)]
Animating sprites

This demo uses the existing "walk cycle animation" available in the loaded
pattern table to make a sprite animate in place.  To achieve this, we do a few
different things:

* To keep track of what cell/frame to animate and where to put the sprite, we
  bring in some RAM in the "zero page".
* To organize pattern table references into coherent frames of animations, we
  declare an "array" of them called "anim"
* We move the loading of sprite tiles into OAM into a subroutine, making this
  the first case of using a subroutine
* We implement a drawing process in the handler for the non-maskable interrupt
  (NMI).  This not only tells us when it's time to draw but also lets us have
  a sense of how much time has elapsed so we can decide when to change frames
  of animation.

That's a lot to digest, but the good news is that this is rapidly progressing
towards being an actual animation engine!

5 years agoDrawing sprites lab_4
Rhett Aultman [Mon, 1 Oct 2018 15:21:24 +0000 (11:21 -0400)]
Drawing sprites

This demo shows how to use the Object Attribute Memory (OAM), a part of
the PPU memory space dedicated to working with sprites.  Additionally,
this demo uses the OAM DMA technique for trasferring a full OAM table
from RAM into the PPU memory space, since this is the most common
technique used by NES game programmers.

5 years agoPattern, name, and attribute tables lab_3
Rhett Aultman [Tue, 18 Sep 2018 04:59:39 +0000 (00:59 -0400)]
Pattern, name, and attribute tables

This commit shows how to load pattern, name, and attribute tables, and
explains their roles in rendering graphics.  A simple pattern table with
text characters as well as some multi-pattern graphics is shown.

5 years agoDraw a background color lab_2
Rhett Aultman [Sat, 15 Sep 2018 15:20:08 +0000 (11:20 -0400)]
Draw a background color

This demo builds on the previous one and focuses on waiting for the NES
PPU to initialize, interacting with VRAM addresses, loading the
background palettes, and getting a background color to draw on the
screen.

5 years agoChange jump target in infinite loop lab_1
Rhett Aultman [Thu, 13 Sep 2018 19:48:52 +0000 (15:48 -0400)]
Change jump target in infinite loop

The jump target should have been to "forever", not "reset"

5 years agoNES Hello World ROM template_project
Rhett Aultman [Thu, 13 Sep 2018 16:30:43 +0000 (12:30 -0400)]
NES Hello World ROM

This is a commit showing all the basic boilerplate needed to compile
and link an rom for NES emulators.  This requires cc65 to compile.  The
ROM will produce a buzzing square wave on the audio synthesizer and then
loop forever, but it's a great "first ROM" and contains the
documentation you really need to understand what's going on.

5 years agoInitial commit
Rhett Aultman [Thu, 13 Sep 2018 01:32:12 +0000 (21:32 -0400)]
Initial commit