scene.org File Archive

File download

<root>­/­resources­/­docs­/­console/famitech2.txt

File size:
10 223 bytes (9.98K)
File date:
2024-08-11 05:45:01
Download count:
all-time: 9

Preview

matt:~ %more snestech.txt
Memory Map
~~~~~~~~~~ 
Bank    Address
~~~~    ~~~~~~~

 00-    0000-1fff       Lo RAM  (same as at $7e0000-$7e1fff)
 7d     2100-2142(?)    Videochip Registers
        4300-437f       DMA Registers

        8000-ffff       ROM:This contains 32k block of game ROM.
                            So, the games are divided to 32k chunks
                            which locate always at address $8000-$ffff,
                            but in different banks. This means that the first
                            32k of game is at $008000-$00ffff and next 32k
                            is at $018000-$01ffff etc.

 7e     0000-1fff       Lo RAM (same as always at $0000-$1fff)  \ 
        2000-ffff       RAM    \ I'm not sure about              } 128k RAM
 7f     0000-ffff       RAM    / this RAM                       /

 7f-ff  all             Not used???

$ffec($fffc) contains reset vector and $ffea($fffa) is NMI vector. The NMI is
actually vertical blank interrupt.

$ffc0   Cartridge Title
$ffd6   Rom/Ram Info On Cart
$ffd7   Rom Size
$ffd8   Ram Size
$ffd9   Maker ID Code
$ffdb   Version Number
$ffdc   Checksum Complement
$ffde   Checksum
....
$ffec   Reset Vector
etc..
REMEMBER with magicom files the offset is $7e00 less than above.

Video Chip
~~~~~~~~~~
size    loc.
~~~~    ~~~~
  B     2100    Screen fade  x000bbbb   x=screen on/off  b=brightness(0-f)
  B     2101    Sprite Sizes aaaxxxxx   aaa= 2 sizes used xxxxx = address 
  W     2102    Address of OAM - Sprites to the rest of us.
 2B     2104    Data for OAM
  B     2105    Screen Mode abcd0xyz abcd = toggles 8/16 tile size xyz=Mode
  B     2106    Screen Mozaik xxxxbbbb  x=pixel size b=planes to expand
  B     2107    Plane 0 location in vram  xxxxxxab x=address ab=32/64 width xy
  B     2108    Plane 1 location in vram  xxxxxxab      as above
  B     2109    Plane 2 location in vram  xxxxxxab      as above
  B     210a    Plane 3 location in vram  xxxxxxab      as above
  B     210b    Tile VRAM address  aaaabbbb a=Playfield 1   b=Playfield 0       
  B     210c    Tile VRAM address  ccccdddd c=Playfield 3   d=Playfield 2       
 2B     210d    Plane 0 scroll x   8+3 bits (0-7ff) put first 8 bits and then
 2B     210e    Plane 0 scroll y   8+3 bits  (0-7ff)  3 highest bits
 2B     210f    Plane 1 scroll x                as above
 2B     2110    Plane 1 scroll y                as above
 2B     2111    Plane 2 scroll x                as above
 2B     2112    Plane 2 scroll y                as above
 2B     2113    Plane 3 scroll x                as above
 2B     2114    Plane 3 scroll y                as above
 B      2115    Video port control
 W      2116    Video port address (lo-hi)
 W      2118    Video port data (lo-hi) (address is incremented by 2)
 B      211a    Mode 7 Info - Bit 0+1 H/V Flip 6+7 - landscape repeat type
 B      211b    Cosine rotate angle / X Expansion
 B      211c    Sine rotate angle / X Expansion
 B      211d    - Sine rotate angle / Y expansion
 B      211e    cosine rotate angle / Y expansion
2B      211f    13 bit address - centre of rotate x
2B      2120    13 bit address - centre of rotate y
 B      2121    Palette color nr
 B      2122    Palette color data
 B      212C    Playfield/Sprite Enable vwyzabcd  a-d = playfield no..
                                        vwyz = sprite enables 
 B      2133    Screen mode  0000ab0c a=Interlace Y  b=Overscan  c=Interlace X??
     2140-2143  Audio Registers

I/O
~~~
  B     4200    Bit 4+5 H+V Counter Enable
  B     4201    8 Bit parallel data (expansion bus under famicom)
W B     420b    Start dma (enable bits) bits: 76543210 = dma nr (8 DMA's)
  B     420d    Memory Select - bit 0 is fast/normal rom flip..
  B     4211    Bit 7 IRQ enable flag
R B     4212    Pad ready to be read
R W     4218    Pad 0 data      76543210 = A-B-Select-Start-U-D-L-R
        4219                    76543210 = X-Y-Top Left-Top Right-0000
R W     421a    Pad 1 data              as above 
R W     421c    Pad 2 data              as above
R W     421e    Pad 3 data              as above

DMA registers  ($4300-$437f)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  B     43X0    DMA control reg??(not sure!)
  B     43X1    DMA destination (Access only to some of the video chip
                    registers ($2100-$21ff)
                    $18=video port  $22=color palette
  W     43X2    Source address lo-hi  16 lowest bits
  B     43X4    Source Bank addr. 8 highest bits
  W     43X5    Transfer size lo-hi

        X=dma number (0-7)  DMA #0= 4300-4305
                            DMA #1= 4310-4315 ...
                            DMA #7= 4370-4375

 Symbols:  size: B=byte long    2B=put 2 bytes    W=word long
             R=read only  W=write only

Screen Mode Defintions
~~~~~~~~~~~~~~~~~~~~~~~

 Mode   No/Playfields   Max. Col/tile   Palettes        Colors
  0        4                   4           8               32
  1        3                16/16/4        8              128
  2        2                  16           8              128
  3        2                 256           1              256
  4        2                 256           1              256
  5        2                  16           8              128
  6        1                  16           8              128 - interlace mode
  7        1                 256           1              256 - MODE 7!!!!

Sprites (or OAM's as Nintendo deem them)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
These use a lookup table that contains the info on position size etc.. the table
format is as follows :-
Address         Contents
  0             Sprite 0 X location
  1             Sprite 0 Y location
  2+3           Lo/Hi :=        Bit 15/14 V/H Flip
                                Bit 12+13 Playfield priority
                                Bit  9-11 Palette Number
                                Bit  0-8  Character NUmber
  4             Sprite 1 X location
        .....
all the way down to 128 sprites..
then a block follows that uses 2 bit for each sprite ie byte 0 of this block con
tains info
for sprites 0,1,2 and 3 - therefore 128/4 = 32 bytes!!!
 lo bit of these 2 is the MSB of X position
 hi bit of these 2 is the size toggle - set in 2101 the 2 sizes - 000 in 2101 = 
8x8 or 16x16
                                                                  001         = 
8x8 or 32x32

so the four bytes/sprites + the block are put in the OAM table by consecutive wr
ites to the
OAM data register - set OAM address to 0 and then zap your table into OAM_Data .
..
REMEMBER - if you dont set the block after the OAM as well - you will probs get 
nowt happenin!!
 - so have a default 'blank' table that u dump down at the start..
        
Magicom registers
~~~~~~~~~~~~~~~~~
Disk Registers:-                R                       W
$C000                   Input Register
$C002                                           Digital Output Register
$C004                   Main Status Reg.
$C005                   Data Register           Data Register
$C007                   Digital Input Reg.      Disk Control Register
$C008                   Parallel Data           Parallel Data
$C009                   Parallel Status

Memory Controller:-
        $E000 - $e00d ish


Screen Details
~~~~~~~~~~~~~~
Famicom Tile format is simple. Each Tile is 4 planes and 8x8 bits.
32 bytes are used per Tile .

PLANES 1  &  2                  PLANES  3  &    4
    byte0   byte1                  byte 16   byte 17  
    byte2   byte3                  byte 18   byte 19
    byte4   byte5                  byte 20   byte 21
     .....                              .......
    byte14  byte15                 byte 30   byte 31

Screen Map
~~~~~~~~~~
Famicom can use only Tiles $0-$3ff, max 1024 chars.
16 bits:   YX?c ccNN NNNN NNNN
           fedc ba98 7654 3210

  Y = mirror y     X = mirror x
  ccc = palette nr (8 palettes)   NN.. = character number

Screen Resolution is normally 32x32 chars but only the first 30 y blocks are 
visible (until scrolled) - 64 bytes / line

Screen VRAM Location
~~~~~~~~~~~~~~~~~~~~
Screen Width 32x32 offset for x,y       0,0   = 0

Screen Width 64x32 offset for x,y       0,0   = 0
                                        32,0  = $400

Screen Width 32x64 offset for x,y       0,0   = 0
                                        0,32  = $400 

Screen Width 64x64 offset for x,y       0,0   = 0
                                        32,0  = $400
                                        0,32  = $800
                                        32,32 = $c00

As can be seen if a wider mode is selected the extra height/width follow
after the main screen in memory.


The Nintendo Super Famicom is capable of displaying 256 colours from a
palette of 32,768. These 256 colours are split into 8 palettes of 32 colours
each.

To change the colours the following needs to be done:

Loading the palette control register ($2121) with the colour number you wish
to change (0-255, 0=background).
Then load the colour into the palette data register first the low 8 bits,
followed by the high 7 bits (this gives you the maximum 32768 colours
possible $0000-$7fff).

Colour data is made up of 3 components (Red,Green,Blue) each of 5 bits (The
Amiga uses exactly the same system, but only using 4 bits per component).
Saying that, Nintendo being the stupid japanese idiots they are decided that
R,G,B wasn't alphabetically correct and so opted to store the bits as B,G,R.

                      00000 00000 00000
                      \   / \   / \   /
                       \ /   \ /   \ /
                        B     G     R

Examples:
~~~~~~~~~
         11111 00000 00000 = $7C00 (Bright Blue)
         00000 11111 00000 = $03E0 (Bright Green)
         00000 00000 11111 = $001F (Bright Red)
         00000 00000 00000 = $0000 (Black)
         11111 11111 11111 = $7FFF (White)

Easy, isn't it?? (But remember to load the lowest 8 bits first, then the top
                  7 bits).


matt:~ %