********************************
* About our cool platform *
********************************
(C) FRACTAL 01/27/2004
We will talk about the device and ra-
NES bot. This information is hopefully
I hope it will be useful to those who
I'm going to start coding on the NES. Underline-
well, which is much more useful
there are smarter people. Info-
there is enough talk about the NES in the Inter-
nope. So I don't pretend to
completeness of the information provided
tions.
First about NES memory:
$0000-$OOFF - zero page,
RAM, it can be accessed with
using special addressing
(only the low byte is indicated
addresses). Also page zero
used for index address
sations (command like lda ($00),y
is done like this: the value is read
value from cell ($0000), two-
byte address, adds to it -
Xia displacement y, from the obtained
byte value is taken and written
goes into the battery).
$0100-$01FF - stack area,
low byte of the pointer address
The stack is contained in the S register.
$0200-$07FF - RAM.
$0800-$1FFF - copy of RAM, not used
enjoys.
$2000-$ХFFF - external registers
NES devices and their copies.
$5000-$SFFF -extended RAM for
special mapper MMCS plus
registers of this mapper (mapper -
This is a device that controls
new NES memory).
$6000-$7FFF -RAM for saves.
$8000-$FFFF - valid pa-
crush ROMs. Those. two pages
memories containing the program and
datacartridge.
This is the entire address space
NES. All its other extensions
are used using mappers.
Next, a few words about PPU.PPU
- this is a picture processing unit,
second processor built into
NES for working with graphics. Basics -
nal registers of this device
addressed in main memory:
$2000 - PPU Control Register#1
$2001 - PPU Control Register#2
$2002 - PPU Status Register
$2005 - Background Scroll
$2006, $2003 - Address Register
$2007, $2004 - I/O Register
(in these pairs the second registers
work with sprites)
PPU has its own memory. Below the price
its description is given:
$0000-$1FFF - Pattern Tables,
only two pieces, contain a set
data by tiles (8*8 squares
pixels that make up
background and sprites). Act-
The tile format is as follows: first
la there are eight bytes, and then another
eight bytes. Each point is driven
correspond to one bit in
first and one in the second sequence
value (i.e. a point in the tile
can have one of four colors
Comrade).
$2000-$2FFF - four Name Tables.
One of them (installed via
special register) is
active. Name Table Size -
$03C0, and another $40 bytes are allocated
for additional data about at-
ributah (flowers).
$3F00 - $3F1F - palette, 16 each
colors for backgrounds and sprites.
There is also SPR-RAM - $100 bytes
data on 64 sprites (4 bytes each)
ta: x, tile number, attributes, y)
Addressing in itcarried out
register $2003 (start - $0000).
Three more useful registers:
$4014 - Sprite DMA Register
(fast exchange with SPR-RAM)
$4016 - first joystick
$4017 - second joystick
And now a small example - for-
writing a palette from memory to video
memory. The example can be compiled
to use Nesasm v2.0, which I
I use it.
.inesprg 1
.ineschr 0
.inesmap 0
.inesmir 0
;place the label in the zero country-
;face
.zp
PALadr.LO = $00
PALadr.HI = $01
;program code
.code
.bank 0
.org $8000
Start:
cld ;so
sei ;accepted
jsr stopPPU
ldx #$FF;stack
txs
lda #LOW(Palette)
sta
;vector table: nonmass vector
;activated interrupts, resets,
;software interrupts (according to
;BRK structures)
.bank 1
.org $FFFA
.dw 0
.dw Start
.dw0
________________________________
Share your thoughts about the article