Code:
RSSET - Set the internal counter of the RS directive to
a specified value.
RS - Assign a value to a symbol; a bit like EQU but here
the value assigned is taken from an internal counter,
and after the assignation this counter is increased
by the amount specified in the RS directive.
This is a very handy way of defining structure member
offsets, here's a small example:
; C:
; --
; struct {
; short p_x;
; short p_y;
; byte p_color;
; } pixel;
;
; ASM:
; ----
.rsset $0 ; set the initial value of RS counter
P_X .rs 2
P_Y .rs 2
P_COLOR .rs 1
You can later use these symbols as offsets in a 'pixel'
struct:
ldy #P_COLOR
lda [pixel_ptr],Y
I'd still go with using
equ/= for MMIO registers, though, because you're going to have to treat them all as 8-bit values regardless. There aren't that many to define for the NES, and they aren't all linear (for example once you get past the PPU stuff, you jump to $40xx for more registers and so on.
Besides -- and please ponder this before responding -- does this not make more immediate sense to someone when looking at the code (knowing what equate name correlates directly with what address)?
Code:
PPUCTRL = $2000
PPUMASK = $2001
PPUSTATUS = $2002
OAMADDR = $2003
OAMDATA = $2004
PPUSCROLL = $2005
PPUADDR = $2006
PPUDATA = $2007
Compared to this?
Code:
.rsset $2000
PPUCTRL .rs 1
PPUMASK .rs 1
PPUSTATUS .rs 1
OAMADDR .rs 1
OAMDATA .rs 1
PPUSCROLL .rs 1
PPUADDR .rs 1
PPUDATA .rs 1
I can definitely see
.rsset/.rs being useful for non-MMIO regions or portions of those regions, e.g. ZP ($00-FF), STACK ($0100-01FF depending on how you have stuff set up), RAM ($0200-07FF depending on how you have stuff set up with regards to what I just said), SRAM ($6000-7FFF), etc. since something like
.rsset $6000 / SRAM .rs $2000 makes a lot of sense. But for MMIO registers it just seems OCD.
TL;DR -- Do whatever you want, and if you aren't familiar with your assembler, read the documentation that comes with it (the documentation file included with NESASM3 is named
usage.txt).