home *** CD-ROM | disk | FTP | other *** search
/ Der Mediaplex Sampler - Die 6 von Plex / 6_v_plex.zip / 6_v_plex / DISK3 / DFUE_100 / FAMITXT.ZIP / SNESDOC.TXT < prev    next >
Internet Message Format  |  1994-02-07  |  56KB

  1. From:     Jeremy Chadwick <yoshi@CSOS.ORST.EDU>
  2. To:       "Super Famicom Development Group" <famidev@busop.cit.wayne.edu>
  3. Subject:  SNES Document v1.0
  4. Date:     Thu, 11 Nov 1993 01:22:14 -0800
  5. Reply-to: famidev@busop.cit.wayne.edu
  6. Sender:   Listserv@busop.cit.wayne.edu
  7. X-Mailer: Mercury MTA v1.0.
  8.  
  9. The following file is written by yours-truly (!). I got sick of people writing
  10. shit-fuck documentation, so I decided to write my own. I hope you enjoy it.
  11.  
  12. =-=-=
  13. SNES Documentation v1.0: Written by Yoshi of Digital Exodus. 
  14. =-=-=
  15. 0)    "Why write a document like this?" 'Why ask why, code 'till ya die'
  16. 1)    Memory Map.
  17.        i) "Main" memory map.
  18.       ii) Etc...
  19. 2)    SNES Color explaination.
  20. 3)    SNES DMA Memory Map and explaination.
  21. 4)    SNES Graphics (tiles) explaination.
  22. 5)    SNES Screen mode definitions.
  23. 6)    SNES OAM/Sprite explaination.
  24. 7)    Magicom Disk registers and Memory controller locations.
  25. 69)   About the author (ME! :-))...
  26. FF)   Greetings, Thanx, etc...
  27. =-=-=
  28. 0)    "Why write a document like this?" 'Why ask why, code 'till ya die'
  29. -----------                              
  30.       I've been asked the same question over the last few weeks:
  31.       "Yoshi, why write a document on the Super Nintendo? I mean, it's
  32.       fucking impossible to program on such a lame machine," or "Why
  33.       waste your time?"
  34.  
  35.       Simple. I'm really tired (yawn) of seeing people write documents
  36.       like their brain is more advanced than their English. I'm tired
  37.       of seeing bullshit documentation (someone on the InterNET supplied
  38.       me with a document they wrote from scratch before they checked
  39.       any of the locations, or even other documents: The document was
  40.       a fucking joke: Over 95% of the registers I list in the following
  41.       Sections were labelled "???"), and documentation which has MAJOR
  42.       bugs in it (like the Corsair & Dax document; the joypad-input
  43.       section. Jesus Christ, guys, atleast get the JOYPAD SHIT RIGHT!
  44.       Thou, the rest of the doc was great! Thanx!).
  45.  
  46.       So, over the last few weeks, i've come up with this document by
  47.       skipping a few classes, missing my IRC-chats at night, staying
  48.       up until 6AM on the weekends to code 'n document, and even not
  49.       doing laundry for a good 3 or 4 days (gross huh?): But it's
  50.       here, and i'm glad I wrote something which can help out other
  51.       people. I'm just sad to say that I used most of the other
  52.       documents as references: I only tested a few of the registers
  53.       for this document: Otherwise I just code with the documents
  54.       which are available to me... and many of them i've cursed at
  55.       because they were wrong, which made me ending up spending an
  56.       hour or two trying to figure out what was wrong.
  57.  
  58.       Anyways, enjoy the document. I hope it helps those out there
  59.       who keep asking me "How do I start? I know assembly, but I have
  60.       no documentation on the machine!!!". I even included some
  61.       demo code all over this document, 'pecially in Section 4. 
  62.       *** NOTE *** All demo code is made for SNEASM v1.05. If you
  63.       have v1.01 or v1.02, then change all the "dcb" statements
  64.       to "dc.b"... also, anything I list in binary via "dcb %" can't
  65.       be done in SNESASM v1.01 or v1.02. v1.05 is the newest develop-
  66.       ment kit, and it's very cool: Thanx to Norman Yen for supplying
  67.       me with it!!! THANX NORM!!!
  68.  
  69.       All typos in the document are my fault: I type fast, so typos
  70.       may be consistant in some parts (which are usually the parts
  71.       where I was up at 3AM typing this, my eyes barely open, and
  72.       my mind falling out of my skull). I'd assume 95% of the
  73.       information here is correct: *** IF YOU FIND SOMETHING WHICH
  74.       ISN'T, ---> TELL ME! <--- ***. I'll fix it ASAP, and put out
  75.       a new version of the document every 5 bug reports.
  76.  
  77.       Give me feedback on what you think too... check Section 69
  78.       (heh heh heh) for an explaination about how to contact me
  79.       and the such. If you know something I don't, --TELL ME!--.
  80.  
  81.       If you're looking for MODE 7 information, don't look at me:
  82.       I don't know how to use it, or sprites: So check someplace
  83.       else, like in the Corsair Document, or your library. Just ask
  84.       them for full documentation on SNES MODE 7 w/ 8 bitplane de-
  85.       finition, EXTBG mapping, and 256 colors: They'll probably end
  86.       up shitting their pants, but that's OK.
  87.                                           
  88.                                            Yoshi of Digital Exodus.
  89.                                            November 5th, 1993.
  90. =-=-=
  91. 1)    Memory Map.
  92.        i) "Main" memory map.
  93. -----------                              
  94.       Just so you know... the R and/or W's on the left side before the             
  95.       memory location mean [R]eadable and/or [W]riteable. I don't know
  96.       what happens if you try to read from the write-only registers:
  97.       I think you get bogus data, but that's about it.
  98. -----------                              
  99.  W   |$2100: Screen display register.
  100.                   Hi   | Lo
  101.                   x000 | bbbb
  102.                               x:    0 = Screen off.
  103.                                     1 = Screen on.
  104.                            bbbb: 0-$F = Brightness of screen.
  105.  
  106.                   *** If you increment $2100 so the register goes up
  107.                       to $xF (x being whatever), you can make the
  108.                       screen "fade in". Make -SURE- you do this only
  109.                       during the VBlank period! If you don't, the screen
  110.                       goes totally wacko! The 'GS programmers like myself
  111.                       call it "Syncing to the VBL". Get used to the term.
  112. -----------                              
  113.  W   |$2101: OAM (Sprite) sizes.
  114.                   Hi   | Lo
  115.                   aaab | bbbb
  116.                               a: Sizes. 
  117.                               b: Address of OAM (Sprite).
  118.  
  119.                   *** The sizes are defined as follows:
  120.                               000: 8x8 or 16x16
  121.                               001: 8x8 or 32x32
  122.  
  123.                   *** I've never used this register, nor sprites.
  124.                       Check Section 6 for information
  125.                       which was not done by me: If you understand
  126.                       it better than I do, good deal.
  127. -----------                              
  128.  W   |$2102: Address of OAM (Sprites).
  129.                   Hi1  | Lo1  | Hi   | Lo
  130.                   ???? | ???? | ???? | ????  
  131.                   
  132.                   *** This register i've never used. All I know is
  133.                       that it's a -WORD- in length, not a byte.
  134. -----------                              
  135.  W   |$2104: Data for OAM (Sprites).
  136.                   Hi   | Lo
  137.                   ???? | ????
  138.  
  139.                   *** I've never used this register. It's like $210D:
  140.                       You have to store a value in it twice.
  141. -----------                              
  142.  W   |$2105: Screen mode.
  143.                   Hi   | Lo
  144.                   abcd | 0eee
  145.                               a \ 
  146.                               b  \ Somehow "toggles" 8/16 (???) mode.
  147.                               c  /
  148.                               d /
  149.                               e: MODE definition. MODEs range from
  150.                                  0 to 7, therefore:
  151.                                  %000 for MODE 0, %001 for MODE 1,
  152.                                  %010 for MODE 2, %011 for MODE 3,
  153.                                  %100 for MODE 4, %101 for MODE 5,
  154.                                  %110 for MODE 6, and %111 for MODE 7.
  155. -----------                              
  156.  W   |$2106: Screen pixelation (aka. MOSAIC) register.
  157.                   Hi   | Lo
  158.                   xxxx | abcd
  159.  
  160.                               x: 0-$F = Pixel size.
  161.                               a: Affect plane 3.
  162.                               b: Affect plane 2.
  163.                               c: Affect plane 1.
  164.                               d: Affect plane 0.
  165.  
  166.                   *** Just like $2100, this only works during VBlank.
  167.                       I recommend you setup what planes you want to
  168.                       affect at the start of the program, then to
  169.                       make them change, do the following:
  170.                               LDA #$03    ; Affect planes 0 and 1.
  171.                               STA TempReg1
  172.                               STA $2106
  173.                               JSR WaitVBlank
  174.                               LDA TempReg1
  175.                          Loop STA $2106
  176.                               CLC
  177.                               ADC #$10
  178.                               CMP #$F0
  179.                               BNE Loop
  180. -----------                              
  181.  W   |$2107: Plane 0 VRAM location register.
  182.                   Hi   | Lo
  183.                   xxxx | xxab
  184.                               x: Address of VRAM location.
  185.                              ab: Tile size (?) 32 or 64.
  186.  
  187.                   *** The way I use this register is pretty simple.
  188.                       Lets say the VRAM is in $2000... Therefore,
  189.                       we'd go like this:
  190.                               LDA #$20
  191.                               STA $2107
  192. -----------                              
  193.  W   |$2108: Plane 1 VRAM location register.
  194.  W   |$2109: Plane 2 VRAM location register.
  195.  W   |$210A: Plane 3 VRAM location register.
  196.                   *** All of these follow the same definition as $2107.
  197. -----------                              
  198.  W   |$210B: Tile VRAM location register.
  199.                   Hi   | Lo
  200.                   aaaa | bbbb
  201.                               a: Location of tiles for Plane 1.
  202.                               b: Location of tiles for Plane 0.
  203.  
  204.                   ***  The way you use this register is fairly neat.
  205.                        Since you only have a nybble to work with (which
  206.                        ranges from $0-F only) your Tile location can
  207.                        only be $0000 to $F000. You can't have an address
  208.                        such as $5F91 or $1C4A which holds your tile
  209.                        data. You just can't have it. :-)
  210.  
  211. -----------                              
  212.  W   |$210C: Tile VRAM location register.
  213.                   Hi   | Lo
  214.                   cccc | dddd
  215.                               c: Location of tiles for Plane 3.
  216.                               d: Location of tiles for Plane 2.
  217.  
  218.                   *** Same stats for $210B go for this one; 'cept the
  219.                       plane registers are different.
  220. -----------                              
  221.  W   |$210D: Plane 0 X-scroll register.
  222.                   *** This register is really funky. You have to write
  223.                       to it twice in a row (each piece of data being
  224.                       1 byte). The register is setup as the following:
  225.                       - You store the first 8 bits (the first byte) which
  226.                         ranges from $00 to $FF. After you store this
  227.                         value, you have to store the next 3 bits in the
  228.                         same register.
  229.                   *** The following code demonstrates how to move plane 0
  230.                       left:
  231.                               LDA Plane0X
  232.                               DEC
  233.                               STA Plane0X
  234.                               STA $210D
  235.                               STZ $210D
  236.                       If you make that into a loop by itself, the result
  237.                       is the plane keeps scrolling left forever; it even
  238.                       wraps around back to the start.
  239. -----------                              
  240.  W   |$210E: Plane 0 Y-Scroll register.
  241.  W   |$210F: Plane 1 X-Scroll register.
  242.  W   |$2110: Plane 1 Y-Scroll register.
  243.  W   |$2111: Plane 2 X-Scroll register.
  244.  W   |$2112: Plane 2 Y-Scroll register.
  245.  W   |$2113: Plane 3 X-Scroll register.
  246.  W   |$2114: Plane 3 Y-Scroll register.
  247.                   *** All of these follow the same definition as $210D.
  248. -----------                              
  249.  W   |$2115: Video port control.
  250.  W   |$2116: Video port address. 
  251.                   *** The doc I have says:
  252.                       "(lo-hi)". 
  253.  W   |$2118: Video port data. 
  254.                   *** "(lo-hi) (address is incremented by 2)"
  255. -----------                              
  256.  W   |$211A: MODE 7 Information register.
  257.                   Hi   | Lo
  258.                   xy?? | ??ab
  259.                               a: Horizontal or Vertical flip. 
  260.                               b: Horizontal or Vertical flip.
  261.                               x: Landscape repeat type.
  262.                               y: Landscape repeat type.
  263.  
  264.                   *** I have not the SLIGHTEST idea what the hell
  265.                       the original author means by this. If someone
  266.                       can explain it, tell me.
  267. -----------                              
  268.  W   |$211B: COS (COSIN) rotate angle / X Expansion.
  269.  W   |$211C: SIN (SIN) rotate angle / X Expansion.
  270.  W   |$211D: SIN (SIN) rotate angle / Y Expansion.
  271.  W   |$211E: COS (COSIN) rotate angle / Y Expansion.
  272.  W   |$211F: 13 bit address for the center of Rotate X.
  273.  W   |$2120: 13 bit address for the center of Rotate Y.
  274.  
  275.                   *** All above things i've never used, nor do I
  276.                       have any explainations on them. Use them at
  277.                       your own risk, or until I get info on 'em.
  278.  
  279.                   *** $211F and $2120 are like $210D: You have to
  280.                       write a byte to them twice.
  281. -----------                              
  282.  W   |$2121: Color # (or pallete) selection register.
  283.                   Hi   | Lo
  284.                   xxxx | xxxx
  285.                               x: Color # ($00-$FF).
  286.  
  287.                   *** This register is probably one of the most simple
  288.                       registers I know of to use. You simply store the
  289.                       # of the color you want to modify before writing
  290.                       to $2122. This register is autoincrementing, so
  291.                       you don't have to "LDA #$01, STA $2121, LDA #$02,
  292.                       STA $2121, LDA #$03..." and so on...
  293.                       Code is as follows:
  294.                               STZ $2121   ; Start at color 0.
  295.                               STZ $2122   ; Color #0 = 00 00
  296.                               STZ $2122
  297.                               LDA #$FF    ; Color #1 = 7F FF (white).
  298.                               STA $2122
  299.                               LDA #$7F
  300.                               STA $2122
  301.                               LDA #$1F    ; Color #2 = 00 1F (red).
  302.                               STA $2122
  303.                               STZ $2122
  304. -----------                              
  305.  W   |$2122: Color data register.
  306.                   Hi   | Lo
  307.                   xxxx | xxxx
  308.                               x: Value of color.
  309.  
  310.                   *** Color on the SNES is trippy; it's 15 bit. Check
  311.                       Section 2 on how the SNES colors are setup. Some
  312.                       example code I listed for $2121... Anyways, this
  313.                       register is like $210D (plane X-scroll) and those
  314.                       types: You have to store the value in it twice.
  315.                       For instance: If you wanted the color white (which
  316.                       is $7FFF in SNES-color), you would have to do the
  317.                       following:
  318.                               LDA [whatever color #]
  319.                               STA $2121
  320.                               LDA #$FF    ; We first store the "lower half"
  321.                               STA $2122
  322.                               LDA #$7F    ; Then the upper...
  323.                               STA $2122
  324.                       It's really not that hard, but it'll take some
  325.                       getting used to :-) Remember, check Section 2 on
  326.                       how the SNES does it's color, and for tile-setup,
  327.                       check Section 4.
  328. -----------                              
  329.  W   |$212C: Playfield/Sprite-enable register.
  330.                   Hi   | Lo
  331.                   abcd | efgh
  332.                               a: Plane 3 enable (for Sprites).
  333.                               b: Plane 2 enable (for Sprites).
  334.                               c: Plane 1 enable (for Sprites).
  335.                               d: Plane 0 enable (for Sprites).
  336.                               e: Enable plane 3.
  337.                               f: Enable plane 2.
  338.                               g: Enable plane 1.
  339.                               h: Enable plane 0.
  340.                   *** This register allows you to enable which planes
  341.                       you want to put sprites on (to move or etc.) and
  342.                       to scroll, or other neato things. If you wanna
  343.                       use all 4 planes, but no sprites, shove $0F into
  344.                       this register. If you want to use all the planes,
  345.                       but want sprites on planes 1 and 3, you would shove
  346.                       $AF into this register. It's very easy to do.
  347. -----------                              
  348.  W   |$2133: Screen mode register. 
  349.                   Hi   | Lo
  350.                   0000 | ab0c
  351.                               a: Interlace Y.
  352.                               b: Overscan.
  353.                               c: Interlace X.
  354.  
  355.                   *** To be blatently honest, I have -NO FUCKING IDEA-
  356.                       what this register does; I don't understand what
  357.                       Corsair & Dax meant by Interlace and Overscan.
  358.                       If someone can explain this register to me, i'd
  359.                       be very grateful :-).
  360. -----------                              
  361. ??   |$2140       *** These are the audio registers. 'never used 'em.
  362. ??   |$2141           Try shoving data into them; who knows, if you get
  363. ??   |$2142           music sometime, then you know you're on the right
  364. ??   |$2143           track. :-)
  365. -----------                              
  366. ??   |$4200: Counter Enable.
  367.                   Hi   | Lo
  368.                   ??yx | ???a
  369.                               a: Joypad-read Enable (1 = Readable).
  370.                               x: Horizontal Counter Enable.
  371.                               y: Vertical Counter Enable.
  372. -----------                              
  373. ??   |$4201: 8 bit parallel data.
  374.  
  375.                   *** This is the expansion bus for the Famicom.
  376. -----------                              
  377. RW   |$420B: DMA enable register.
  378.                   Hi   | Lo
  379.                   abcd | efgh
  380.                               a: DMA #7.
  381.                               b: DMA #6.
  382.                               c: DMA #5.
  383.                               d: DMA #4.
  384.                               e: DMA #3.
  385.                               f: DMA #2.
  386.                               g: DMA #1.
  387.                               h: DMA #0.
  388.  
  389.                   *** I've personally never used DMA for anything. I hope
  390.                       someone out there has, and can tell me how to use
  391.                       it. :-)
  392. -----------                              
  393. ??   |$420D: Memory select.
  394.                   Hi   | Lo
  395.                   ???? | ???x
  396.                               x: Fast/Normal ROM flip.
  397.  
  398.                   *** I don't know if when bit 0 is set if it's Fast or
  399.                       Normal. Someone find this out for me :-)
  400. -----------                              
  401. ??   |$4211: ?????.
  402.                   Hi   | Lo
  403.                   x??? | ????
  404.                               x: IRQ Enable flag (1: Enabled).
  405.  
  406.                   *** Shit! I don't even know the DESCRIPTION of the
  407.                       register! :-)
  408. -----------                              
  409. RW   |$4212: Joypad-ready register.
  410.                   Hi   | Lo
  411.                   ???? | ???x
  412.                               x: Ready-state bit (1: Ready).
  413.  
  414.                   *** I'm not sure how this register is setup; all I know
  415.                       is how to use it. Code is as follows:
  416.                               PadLoop LDA $4212
  417.                                       AND #$01
  418.                                       BNE PadLoop
  419.                       This waits for the joypad to become ready to read.
  420. -----------                              
  421. RW   |$4218: Joypad #0 register (1 out of 2).
  422.                   Hi   | Lo
  423.                   abcd | 0000
  424.                               a:    0 = A button not pressed.
  425.                                     1 = A button pressed.
  426.                               b:    0 = X button not pressed.
  427.                                     1 = X button pressed.
  428.                               c:    0 = Top-left button not pressed.
  429.                                     1 = Top-left button pressed.
  430.                               d:    0 = Top-right button not pressed.
  431.                                     1 = Top-right button pressed.
  432.                   *** These are self-explainitory. To find out the
  433.                       status of each bit, just AND #$ for that bit...
  434.                       The code for checking is the following:
  435.                               LDA $4218
  436.                               AND #$80    ; Is the A button pressed?
  437.                               BNE YesA    ; Button pressed (bit is 1).
  438.                               LDA $4218
  439.                               AND #$40    ; Is button X pressed?
  440.                               BNE YesX    ; Button pressed (bit is 1).
  441.                               LDA $4218
  442.                               AND #$10    ; Is the top-right button pressed?
  443.                               BNE YesTopR ; Button pressed (bit is 1).
  444.                       ...and so on. It's very simple.
  445.                   *** Note: The Corsair & Dax document was -WRONG-.
  446.                             It took me a good hour or two to find this
  447.                             out, so I decided i'd better write down the
  448.                             CORRECT way to do things; damn you guys! :-)
  449. -----------                              
  450. RW   |$4219: Joypad #0 register (2 out of 2).
  451.                   Hi   | Lo
  452.                   abcd | efgh
  453.                               a:    0 = B button not pressed.
  454.                                     1 = B button pressed.
  455.                               b:    0 = Y button not pressed.
  456.                                     1 = Y button pressed.
  457.                               c:    0 = Select button not pressed.
  458.                                     1 = Select button pressed.
  459.                               d:    0 = Start button not pressed.
  460.                                     1 = Start button pressed.
  461.                               e:    0 = Up not pressed.
  462.                                     1 = Up pressed.
  463.                               f:    0 = Down not pressed.
  464.                                     1 = Down pressed.
  465.                               g:    0 = Left not pressed.
  466.                                     1 = Left pressed.
  467.                               h:    0 = Right not pressed.
  468.                                     1 = Right pressed.
  469.                   *** Same as $4218... Some demo code follows:
  470.                               LDA $4219
  471.                               AND #$80    ; Is the B button pressed?
  472.                               BNE YesB    ; Button pressed (bit is 1).
  473.                               LDA $4219
  474.                               AND #$04    ; Is Down pressed?
  475.                               BNE YesDown ; Button pressed (bit is 1).
  476.                               LDA $4219
  477.                               AND #$02    ; Is Left pressed?
  478.                               BNE YesLeft ; Button pressed (bit is 1).
  479. -----------                              
  480. RW   |$421A: Joypad #1 register (1 out of 2).
  481. RW   |$421B: Joypad #1 register (2 out of 2).
  482. RW   |$421C: Joypad #2 register (1 out of 2).
  483. RW   |$421D: Joypad #2 register (2 out of 2).
  484. RW   |$421E: Joypad #3 register (2 out of 2).
  485. RW   |$421F: Joypad #3 register (2 out of 2).
  486.                         *** Setup is the same as $4218 and $4219.
  487. =-=-=
  488. 1)    Memory Map
  489.       ii) Etc...
  490. -----------                              
  491. RW   |$FFC0: Cartridge title.
  492. RW   |$FFD6: ROM/RAM Info on cart..
  493. RW   |$FFD7: ROM Size.
  494. RW   |$FFD8: RAM Size.
  495. RW   |$FFD9: Maker ID Code.
  496. RW   |$FFDB: Version #.
  497. RW   |$FFDC: Checksum complement.
  498. RW   |$FFDE: Checksum.
  499. RW   |$FFEA: NMI vector/VBL Interrupt.
  500. RW   |$FFEC: Reset vector.
  501.  
  502.                   *** With SMC (Magicom) files the offset is $7e00 less
  503.                       than above.
  504.                   *** I've never actually used this information before:
  505.                       This could be SMC header only; but then why would
  506.                       there be memory locations for such? Strange. I'll
  507.                       leave the information I put in up to SNESASM v1.05.
  508.                       I use the psuedo-ops NAM, VER, and other things.
  509.  
  510. =-=-=
  511. 2)    SNES Color explaination.
  512. -----------                              
  513.       Oh BOY! So you're interested in finding out how the SNES does
  514.       it's color (via $2122), right? Well here ya go...
  515.  
  516.       The SNES has a strange way of doing color (atleast that i've
  517.       seen in my lifetime). Color is 15 bit; each "RGB" value (red,
  518.       green, and blue) has 5 bits a piece.
  519.  
  520.       When it comes to putting data into $2122, the format (in binary)
  521.       is the following (I put them into each nybble, just so you can
  522.       see what each hi and lo nybble looks like):
  523.                         0bbb bbgg gggr rrrr
  524.                         |
  525.                         |_ Someone needs to tell me what this bit
  526.                            -REALLY- is. I've just been told to set
  527.                            it to 0...
  528.       We guess that the Japanese didn't like the idea of putting them
  529.       in the "standard" order of R, G, then B: but instead wanted them
  530.       in alphabetical order...
  531.  
  532.       The way -I- do my color conversions is on a calculator... Just
  533.       plug in the bits you want to set in binary, then let the calc.
  534.       convert it into hexadecimal. It's pretty easy; or you can be
  535.       a Studly Programmer (hehehe) and do it in your head.
  536.  
  537.       A quick color chart:          $7FFF: White  (0111 1111 1111 1111)
  538.                                     $001F: Red    (0000 0000 0001 1111)
  539.                                     $03E0: Green  (0000 0011 1110 0000)
  540.                                     $7C00: Blue   (0111 1100 0000 0000)
  541.                                     $7C1F: Purple (0111 1100 0001 1111)
  542.                                     $7FE0: Aqua   (0111 1111 1110 0000)
  543.                                     $03FF: Yellow (0000 0011 1111 1111);
  544.       Well there you have it. It's pretty simple after you get the hang
  545.       of it; when using the SNES, you get REALLY good with binary math:
  546.       You'll find this out after working with the machine for awhile.
  547.  
  548. =-=-=
  549. 3)    DMA Memory Map and explaination.
  550. -----------                              
  551. ??   |$43x0: DMA Control register (??? Not sure ???).
  552.  W   |$43x1: DMA Destination register.
  553.                   $18 = Video Port access.
  554.                   $22 = Color pallete access.
  555.  
  556.                   *** This gives access to only some of the video chip.
  557.                       registers. Hell if I know which ones.
  558. -----------                              
  559.  W   |$43x2: Source address.
  560.                   *** THIS REGISTER IS A WORD IN LENGTH ***
  561.                   *** The document I have says:
  562.                       "lo-hi  16 lowest bits". Who knows what the
  563.                       fuck the author meant by that...
  564. -----------                              
  565.  W   |$43x4: Source bank address.
  566.                   *** The document I have says:
  567.                       "8 highest bits". Just who in the hell wrote
  568.                       this document on the DMA??? Some dumbass :-)
  569. -----------                              
  570.  W   |$43x5: Transfer size register.
  571.                   *** Same as above:
  572.                       "lo-hi". Gee, how specific can we get?
  573. -----------                              
  574.       All the "x"s represent the DMA # (ranging from 0 to 7).
  575.       DMA #0: $4300-$4305.
  576.       DMA #1: $4310-$4315.
  577.       ......
  578.       DMA #7: $4370-$4375.
  579. =-=-=
  580. 4)    SNES Graphics (tiles) explaination.
  581. -----------                              
  582.       This is probably the most requested section of the document for
  583.       people whom are starting out on the SNES and want to learn just
  584.       how in the hell the SNES -DOES- do it's graphics.
  585.  
  586.       There's so much to fucking explain!!!
  587.  
  588.       The SNES does it's graphics in tiles (surprise surprise!).
  589.  
  590.       There are different MODEs on the SNES; the most famous being
  591.       is MODE 7. Alas: Most people think using $2106 is MODE 7 ($2106
  592.       is for screen pixelation: Where the pixels get "larger". Look 
  593.       in Section 1 for an explaination of this register).
  594.                         *** THIS IS NOT MODE 7!!! ***. 
  595.       So the next time the pixels get really "big" (almost making them
  596.       look like IBM PC 320x200x256 mode :-)), and your friend says "WOW!
  597.       MODE 7 is COOL," punch 'em in the nose for me.
  598.  
  599.       Also, another thing I should mention: Bitplanes are NOT THE SAME
  600.       AS PLANES. Planes are like "screens." You can scroll a plane, but
  601.       not a bitplane. Bitplanes are put ONTO a plane, which can be
  602.       scrolled any direction.
  603.  
  604.       I'll be explaining MODE 1. MODE 7 is too damn tough for me to
  605.       explain, since you end up losing colors and other screwy things...
  606.       Check Section-5 for a mode-# list.
  607.       
  608. MODE   #/Playfields    MaxColor/Tile   Palettes        Colors
  609. ---------------------------------------------------------------------------
  610. 0      4               4               8               16
  611. 1      3               16/16/4 (HUH?)  8               128
  612.       
  613.       MODE 0 is good for geometric shapes (if you were going to rotate
  614.       a wireframe cube), basic star scrolls, or a very "bland" text
  615.       scroller.
  616.  
  617.       Let's start with MODE 1.
  618.  
  619.       MODE 1 is best for really basic things: Star scrollers, text
  620.       scrolls, geometric (non detailed) art, or line drawings; it's
  621.       only 16 colors/bitplane, and there's only 4 bitplanes to play
  622.       with.
  623.  
  624.       What you need is 4 bitplanes of data. You don't -HAVE- to
  625.       use 4 bitplanes... You can use 1 bitplane if you want, but
  626.       you only get 16 colors (NO!!! :-)).
  627.  
  628.       You also need a plane map: You can't just have the predefined
  629.       graphics data and thats it: You have to "setup the plane" to
  630.       tell it what tile goes where.
  631.       
  632.       For demonstration purposes, i'll use code to explain it.
  633.  
  634. -----------                              
  635.       The "lda #$0000" "tcd" transfers the DP location pointer to
  636.       where the scratchpad RAM is. This makes things go much faster,
  637.       because DP is always faster than normal RAM (yay for DP!!!)
  638.       
  639.       The other part puts where the location of the data in the
  640.       binary/image is into two DP locations: font and font2.
  641.  
  642. font  equ $00     ; Direct page equates.
  643. font2 equ font+1
  644.       
  645.       sei
  646.       phk          
  647.       plb          
  648.       clc
  649.       xce
  650.       rep #$30     
  651.       lda #$0000   
  652.       tcd
  653.       lda #charset
  654.       sta font
  655.       lda #charset2
  656.       sta font2
  657. -----------                              
  658.       The following code tells the SNES where the actual data
  659.       is in VRAM memory.
  660.                              
  661.       lda #$10                ; Plane 0 text @ VRAM $1000. 
  662.       sta $2107               
  663.       
  664.       lda #$02                ; Tiles for Plane 0 @ VRAM $2000.
  665.       sta $210b               
  666. -----------                              
  667.       The following code actually MOVES the data in the binary/image
  668.       into the SNES's VRAM.
  669.  
  670.       sep #$20
  671.       ldx #$2000              ; This puts the data sent thru $2118 and 
  672.                               ; $2119 into VRAM $2000.
  673.       stx $2116
  674.       ldy #$0000
  675. -     lda (font),y            ; Get bitplane 0 data (font)
  676.       sta $2118               ; ... and store it in bitplane 0.
  677.       lda (font2),y           ; Get bitplane 1 data (font2)
  678.       sta $2119               ; ... and store it in bitplane 1...
  679.       stz $2118               ; I don't want to use bitplane 2 and 3,
  680.       stz $2119               ; so I store zeros here. You could put
  681.                               ; more font data in there if you wanted.
  682.       iny
  683.       cpy #$0200        
  684.       bne -
  685.       
  686.       ldx #$1000              ; This puts the data sent thru $2118 and              
  687.       stx $2116               ; $2119 into VRAM $1000.
  688.       ldx #$0000
  689. -     lda TEXT,x              ; Get the character from TEXT...
  690.       and #$3f                ; AND #$3F because we only want the first
  691.                               ; 64 characters in the font.
  692.       sta $2118               ; 
  693.       stz $2119               ; Check near the end of this Section for
  694.                               ; an explaination on what the actual bits
  695.                               ; do instead of just storing 0 there all
  696.                               ; the time.
  697.       inx
  698.       cpx #$0400
  699.       bne -            
  700. -----------                              
  701.       Here's the actual data names (charset, charset2, and TEXT).
  702.       My new source has them in dcb % statements to make the font
  703.       more readable: The first time I did this, I had to fucking
  704.       convert the binary stuff I wrote on paper into hex, then put
  705.       them into decent hex statements in an orderly fashion.
  706.  
  707. charset 
  708.       dcb     $00,$00,$00,$00,$00,$00,$00,$00 ;'@'  
  709.       dcb     $00,$3c,$66,$7e,$66,$66,$66,$00 ;'A'
  710.       dcb     $00,$7c,$66,$7c,$66,$66,$7c,$00 ;'B'
  711.       dcb     $00,$3c,$66,$60,$60,$66,$3c,$00 ;'C'
  712.       dcb     $00,$78,$6c,$66,$66,$6c,$78,$00 ;'D'
  713.       dcb     $00,$7e,$60,$78,$60,$60,$7e,$00 ;'E'
  714.       dcb     $00,$7e,$60,$78,$60,$60,$60,$00 ;'F'
  715.       dcb     $00,$3c,$66,$60,$6e,$66,$3c,$00 ;'G'
  716.       dcb     $00,$66,$66,$7e,$66,$66,$66,$00 ;'H'
  717.       dcb     $00,$3c,$18,$18,$18,$18,$3c,$00 ;'I'
  718.       dcb     $00,$1e,$0c,$0c,$0c,$6c,$38,$00 ;'J'
  719.       dcb     $00,$6c,$78,$70,$78,$6c,$66,$00 ;'K'
  720.       dcb     $00,$60,$60,$60,$60,$60,$7e,$00 ;'L'
  721.       dcb     $00,$63,$77,$7f,$6b,$63,$63,$00 ;'M'
  722.       dcb     $00,$66,$76,$7e,$7e,$6e,$66,$00 ;'N'
  723.       dcb     $00,$3c,$66,$66,$66,$66,$3c,$00 ;'O'
  724.       dcb     $00,$7c,$66,$66,$7c,$60,$60,$00 ;'P'
  725.       dcb     $00,$3c,$66,$66,$66,$3c,$0e,$00 ;'Q'
  726.       dcb     $00,$7c,$66,$66,$7c,$6c,$66,$00 ;'R'
  727.       dcb     $00,$3e,$60,$3c,$06,$66,$3c,$00 ;'S'
  728.       dcb     $00,$7e,$18,$18,$18,$18,$18,$00 ;'T'
  729.       dcb     $00,$66,$66,$66,$66,$66,$3c,$00 ;'U'
  730.       dcb     $00,$66,$66,$66,$66,$3c,$18,$00 ;'V'
  731.       dcb     $00,$63,$63,$6b,$7f,$77,$63,$00 ;'W'
  732.       dcb     $00,$66,$3c,$18,$3c,$66,$66,$00 ;'X'
  733.       dcb     $00,$66,$66,$3c,$18,$18,$18,$00 ;'Y'
  734.       dcb     $00,$7e,$0c,$18,$30,$60,$7e,$00 ;'Z'
  735.       dcb     $08,$00,$00,$00,$00,$00,$00,$00 ;'['    
  736.       dcb     $00,$00,$00,$00,$00,$00,$00,$00 ;'\'
  737.       dcb     $00,$00,$00,$00,$00,$00,$00,$00 ;']'
  738.       dcb     $00,$00,$00,$00,$00,$00,$00,$00 ;'^'
  739.       dcb     $00,$08,$00,$00,$00,$00,$00,$00 ;'_'  
  740.       dcb     $00,$00,$00,$00,$00,$00,$00,$00 ;' '  
  741.       dcb     $00,$7E,$7E,$3C,$18,$00,$18,$00 ;'!'
  742.       dcb     $00,$00,$00,$00,$00,$00,$00,$00 ;'"'
  743.       dcb     $80,$80,$80,$80,$80,$80,$80,$80 ;'#'
  744.       dcb     $FC,$FE,$FF,$F7,$F7,$FF,$FE,$FC ;'$'
  745.       dcb     $3E,$42,$4E,$5C,$5C,$4E,$42,$3E ;'%'
  746.       dcb     $00,$00,$00,$00,$00,$00,$00,$01 ;'&'
  747.       dcb     $00,$00,$00,$07,$00,$00,$00,$00 ;'''
  748.       dcb     $00,$04,$08,$08,$08,$08,$04,$00 ;'('
  749.       dcb     $00,$20,$10,$10,$10,$10,$20,$00 ;')'
  750.       dcb     $08,$08,$08,$F8,$08,$08,$08,$08 ;'*'
  751.       dcb     $10,$10,$10,$1F,$10,$10,$10,$10 ;'+'
  752.       dcb     $10,$10,$20,$C0,$00,$00,$00,$00 ;','
  753.       dcb     $00,$00,$00,$FF,$00,$00,$00,$00 ;'-'
  754.       dcb     $00,$00,$00,$00,$00,$18,$18,$00 ;'.'
  755.       dcb     $00,$00,$00,$FF,$80,$80,$80,$80 ;'/'  
  756.       dcb     $00,$3c,$66,$6e,$76,$66,$3c,$00 ;'0'
  757.       dcb     $00,$18,$38,$18,$18,$18,$7e,$00 ;'1'
  758.       dcb     $00,$7c,$06,$0c,$30,$60,$7e,$00 ;'2'
  759.       dcb     $00,$7e,$06,$1c,$06,$66,$3c,$00 ;'3'
  760.       dcb     $00,$0e,$1e,$36,$7f,$06,$06,$00 ;'4'
  761.       dcb     $00,$7e,$60,$7c,$06,$66,$3c,$00 ;'5'
  762.       dcb     $00,$3e,$60,$7c,$66,$66,$3c,$00 ;'6'
  763.       dcb     $00,$7e,$06,$0c,$0c,$0c,$0c,$00 ;'7'
  764.       dcb     $00,$3c,$66,$3c,$66,$66,$3c,$00 ;'8'
  765.       dcb     $00,$3c,$66,$3e,$06,$66,$3c,$00 ;'9'
  766.       dcb     $00,$00,$00,$03,$04,$08,$08,$08 ;':' 
  767.       dcb     $00,$80,$80,$F0,$80,$80,$00,$00 ;';'
  768.       dcb     $80,$80,$80,$FF,$00,$00,$00,$00 ;'<'
  769.       dcb     $00,$00,$00,$C0,$20,$10,$10,$10 ;'='
  770.       dcb     $08,$08,$04,$03,$00,$00,$00,$00 ;'>'
  771.       dcb     $00,$00,$00,$00,$00,$00,$00,$00 ;'?'
  772.  
  773. charset2 
  774.       dcb     $00,$3C,$4E,$5E,$5E,$40,$3C,$00 ;'@'  
  775.       dcb     $00,$3c,$66,$7e,$66,$66,$66,$00 ;'A'
  776.       dcb     $00,$7c,$66,$7c,$66,$66,$7c,$00 ;'B'
  777.       dcb     $00,$3c,$66,$60,$60,$66,$3c,$00 ;'C'
  778.       dcb     $00,$78,$6c,$66,$66,$6c,$78,$00 ;'D'
  779.       dcb     $00,$7e,$60,$78,$60,$60,$7e,$00 ;'E'
  780.       dcb     $00,$7e,$60,$78,$60,$60,$60,$00 ;'F'
  781.       dcb     $00,$3c,$66,$60,$6e,$66,$3c,$00 ;'G'
  782.       dcb     $00,$66,$66,$7e,$66,$66,$66,$00 ;'H'
  783.       dcb     $00,$3c,$18,$18,$18,$18,$3c,$00 ;'I'
  784.       dcb     $00,$1e,$0c,$0c,$0c,$6c,$38,$00 ;'J'
  785.       dcb     $00,$6c,$78,$70,$78,$6c,$66,$00 ;'K'
  786.       dcb     $00,$60,$60,$60,$60,$60,$7e,$00 ;'L'
  787.       dcb     $00,$63,$77,$7f,$6b,$63,$63,$00 ;'M'
  788.       dcb     $00,$66,$76,$7e,$7e,$6e,$66,$00 ;'N'
  789.       dcb     $00,$3c,$66,$66,$66,$66,$3c,$00 ;'O'
  790.       dcb     $00,$7c,$66,$66,$7c,$60,$60,$00 ;'P'
  791.       dcb     $00,$3c,$66,$66,$66,$3c,$0e,$00 ;'Q'
  792.       dcb     $00,$7c,$66,$66,$7c,$6c,$66,$00 ;'R'
  793.       dcb     $00,$3e,$60,$3c,$06,$66,$3c,$00 ;'S'
  794.       dcb     $00,$7e,$18,$18,$18,$18,$18,$00 ;'T'
  795.       dcb     $00,$66,$66,$66,$66,$66,$3c,$00 ;'U'
  796.       dcb     $00,$66,$66,$66,$66,$3c,$18,$00 ;'V'
  797.       dcb     $00,$63,$63,$6b,$7f,$77,$63,$00 ;'W'
  798.       dcb     $00,$66,$3c,$18,$3c,$66,$66,$00 ;'X'
  799.       dcb     $00,$66,$66,$3c,$18,$18,$18,$00 ;'Y'
  800.       dcb     $00,$7e,$0c,$18,$30,$60,$7e,$00 ;'Z'
  801.       dcb     $00,$00,$00,$00,$00,$00,$00,$00 ;'[' 
  802.       dcb     $09,$09,$00,$00,$00,$00,$00,$00 ;'\'
  803.       dcb     $00,$00,$00,$00,$00,$00,$00,$00 ;']'
  804.       dcb     $00,$00,$00,$00,$00,$00,$00,$00 ;'^'
  805.       dcb     $00,$08,$00,$00,$00,$00,$00,$00 ;'_'  
  806.       dcb     $00,$00,$00,$00,$00,$00,$00,$00 ;' '  
  807.       dcb     $00,$7E,$7E,$3C,$18,$00,$18,$00 ;'!'
  808.       dcb     $00,$00,$00,$00,$00,$00,$00,$00 ;'"'
  809.       dcb     $80,$80,$80,$80,$80,$80,$80,$80 ;'#'
  810.       dcb     $FC,$FE,$FF,$F7,$F7,$FF,$FE,$FC ;'$'
  811.       dcb     $3E,$42,$4E,$5C,$5C,$4E,$42,$3E ;'%'
  812.       dcb     $00,$00,$00,$00,$00,$00,$00,$01 ;'&'
  813.       dcb     $00,$00,$00,$07,$00,$00,$00,$00 ;'''
  814.       dcb     $00,$04,$08,$08,$08,$08,$04,$00 ;'('
  815.       dcb     $00,$20,$10,$10,$10,$10,$20,$00 ;')'
  816.       dcb     $08,$08,$08,$F8,$08,$08,$08,$08 ;'*'
  817.       dcb     $10,$10,$10,$1F,$10,$10,$10,$10 ;'+'
  818.       dcb     $10,$10,$20,$C0,$00,$00,$00,$00 ;','
  819.       dcb     $00,$00,$00,$FF,$00,$00,$00,$00 ;'-'
  820.       dcb     $00,$00,$00,$00,$00,$18,$18,$00 ;'.'
  821.       dcb     $00,$00,$00,$FF,$80,$80,$80,$80 ;'/'  
  822.       dcb     $00,$3c,$66,$6e,$76,$66,$3c,$00 ;'0'
  823.       dcb     $00,$18,$38,$18,$18,$18,$7e,$00 ;'1'
  824.       dcb     $00,$7c,$06,$0c,$30,$60,$7e,$00 ;'2'
  825.       dcb     $00,$7e,$06,$1c,$06,$66,$3c,$00 ;'3'
  826.       dcb     $00,$0e,$1e,$36,$7f,$06,$06,$00 ;'4'
  827.       dcb     $00,$7e,$60,$7c,$06,$66,$3c,$00 ;'5'
  828.       dcb     $00,$3e,$60,$7c,$66,$66,$3c,$00 ;'6'
  829.       dcb     $00,$7e,$06,$0c,$0c,$0c,$0c,$00 ;'7'
  830.       dcb     $00,$3c,$66,$3c,$66,$66,$3c,$00 ;'8'
  831.       dcb     $00,$3c,$66,$3e,$06,$66,$3c,$00 ;'9'
  832.       dcb     $00,$00,$00,$03,$04,$08,$08,$08 ;':' 
  833.       dcb     $00,$80,$80,$F0,$80,$80,$00,$00 ;';'
  834.       dcb     $80,$80,$80,$FF,$00,$00,$00,$00 ;'<'
  835.       dcb     $00,$00,$00,$C0,$20,$10,$10,$10 ;'='
  836.       dcb     $08,$08,$04,$03,$00,$00,$00,$00 ;'>'
  837.       dcb     $00,$00,$00,$00,$00,$00,$00,$00 ;'?'
  838.  
  839. TEXT  dcb     " THIS IS YOUR ENTIRE SCREEN     "
  840.       dcb     " HERE... IF YOU REMOVE ONE OF   "
  841.       dcb     " THE LINES WHICH IS BLANK, THE  "
  842.       dcb     " SCREEN ENDS UP BEING FUNKY     "
  843.       dcb     " DOWN AT THE BOTTOM OF THE      "
  844.       dcb     " SCREEN.                        "
  845.       dcb     "                                "
  846.       dcb     " SO MAKE SURE YOU ALWAYS LEAVE  "
  847.       dcb     " ALL OF THIS TEXT THINGS IN!    "
  848.       dcb     "                                "
  849.       dcb     "                                "
  850.       dcb     "                                "
  851.       dcb     "         YOSHI THE DINO         "
  852.       dcb     "                                "
  853.       dcb     "                                "
  854.       dcb     "                                "
  855.       dcb     "                                "
  856.       dcb     "                                "
  857.       dcb     "                                "
  858.       dcb     "                                "
  859.       dcb     "                                "
  860.       dcb     "                                "
  861.       dcb     "                                "
  862.       dcb     "                                "
  863.       dcb     "                                "
  864.       dcb     "                                "
  865.       dcb     "                                "
  866.       dcb     "                                "
  867.       dcb     "                                "
  868.       dcb     "********************************"
  869.       dcb     "                                "
  870.       dcb     "                                "
  871. -----------                              
  872.       Well there's some code for those whom want to rip it :-).
  873.       
  874.       I hope I haven't confused you yet: If I have, go back and re-read
  875.       the code. I've been working with the SNES for awhile, so I under-
  876.       stand a little more than a beginner.
  877.  
  878.       You're probably wondering how the heck the following line ends
  879.       up being an "@" on your TV, or whatever you have your SNES
  880.       hooked up to.
  881.  
  882.       Lets look at charset and charset2.
  883.  
  884. charset 
  885.       dcb     $00,$00,$00,$00,$00,$00,$00,$00 ;'@'  
  886.  
  887. charset2 
  888.       dcb     $00,$3C,$4E,$5E,$5E,$40,$3C,$00 ;'@'  
  889.  
  890.       Convert charsets hex-statements into binary. Consider each
  891.       new "$xx" statement a new pixel line. Tile size is 8x8.
  892.  
  893.       00000000          = $00
  894.       00000000          = $00
  895.       00000000          = $00
  896.       00000000          = $00
  897.       00000000          = $00
  898.       00000000          = $00
  899.       00000000          = $00
  900.       00000000          = $00
  901.  
  902.       Convert charset2s hex-statements into binary. 
  903.  
  904.       00000000          = $00
  905.       00111100          = $3C
  906.       01001110          = $4E
  907.       01011110          = $5E
  908.       01011110          = $5E
  909.       01000000          = $40
  910.       00111100          = $3C
  911.       00000000          = $00
  912.  
  913.       *NOW* do you see the at-symbol? (and yes, I -DID- draw all
  914.       of the font by hand. It took me HOURS, but I did it).
  915.  
  916.       You're probably now asking: "Well, that tells me how to define
  917.       where a pixel IS: but how do I define it's color?"
  918.  
  919.       This is the fun part. It's sort-of hard to explain:
  920.       If you have a 0 for bitplane 0, a 0 for bitplane 1, a 0 for
  921.       bitplane 2, and a 0 for bitplane 3, you get the color 0.
  922.             i.e.: 0000 = Color #0
  923.                   ||||___________Bitplane 0
  924.                   |||__________Bitplane 1
  925.                   ||_________Bitplane 2
  926.                   |________Bitplane 3
  927.  
  928.       So, think about a 0 for bitplane 0, a 1 for bitplane 1 & 2
  929.       and a 0 for bitplane 3.
  930.             i.e.: 0110 = Color #6
  931.                   ||||___________Bitplane 0
  932.                   |||__________Bitplane 1
  933.                   ||_________Bitplane 2
  934.                   |________Bitplane 3
  935.  
  936.       This is probably the best explaination i've ever seen done about
  937.       SNES pixel-color definition, so don't plan on seeing one any
  938.       better anytime soon :-).
  939.  
  940.       Anyway, the result above gives you the color # per pixel; it's
  941.       fairly interesting... it's like an "overlay" type of method.
  942.  
  943.       I mentioned in the source above that you should check near the
  944.       end of the Section for info on why I "stz $2119". Well, here's
  945.       why: The bits in the tile-data are fairly "silly": The tile
  946.       "character" itself is 10 bits, while the other 6 are "fun bits,"
  947.       as I call them. Here's the explaination:
  948.                 Hi1  | Lo1  | Hi   | Lo
  949.                 yx?c | ccNN | NNNN | NNNN
  950.                                     y: Flip the tile vertically.
  951.                                     x: Flip the tile horiztonally.
  952.                                     ?: Dunno! Set it to 1 and find out. 
  953.                                     c: Pallete # (0-7).
  954.                                     N: Character itself.
  955.                                     
  956.       So, I STZ there: Yes, I leave the top bits "unset," which means
  957.       you could get fucked up data, but as far as I have checked, the
  958.       SNES has "clear memory" when you start it up: So the bits I don't
  959.       zero-out should be zeros anyways! :-) If you want to set them,
  960.       feel free to do so! The results of flipping Y and X are sortof
  961.       fun to play with. "To read this scrolly, you must stand on your
  962.       head" :-)
  963. =-=-=
  964. 5)    SNES Screen mode definitions.
  965. -----------                              
  966. MODE   # of bitplanes  Colors per plane  Palletes      Max. # of colors
  967. ---------------------------------------------------------------------------
  968. 0      2               4               8               32
  969. 1      4               16              8               128
  970. 2      ?               ???             ?               ??? 
  971. 3      8               256             1               256
  972. 4      ?               ???             ?               ??? 
  973. 5      ?               ???             ?               ??? 
  974. 6      ?               16              8               128 (Interlaced mode)
  975. 7      ?               256             1               256 (Yes, MODE 7)
  976. ---------------------------------------------------------------------------
  977.  
  978.       The parms which have "?" or "???" mean I don't know what they REALLY
  979.       are: I got a document which explained them, but it was bogus: It
  980.       said a 16 color mode had -1- bitplane. Weird... I'm not even sure
  981.       about MODE 6. But, we know what MODE 7 is, even if I'm not sure how
  982.       many bitplanes it DOES use (the doc says 1, I say 8).
  983.  
  984.       I've tested MODE 0 and 1 myself. MODE 3 I might test in the future,
  985.       but i've never had the desire to draw up 8 bitplanes of data by
  986.       hand ( I don't have a SNES-graphics-generator for the PC! :-( ).
  987. =-=-=
  988. 6)    SNES OAM/Sprite explaination.
  989. -----------                              
  990.       The sprites use a lookup table that contains info on their X and
  991.       Y position on the screen, their size, if they're flipped horizontally
  992.       or vertically, their color, and the actual character.
  993.  
  994.       The format you need to make the table in is as follows:
  995.  
  996. Size  Address/Offset          Explaination
  997. ---------------------------------------------------------------------------
  998. *** SPRITE 0 ***
  999. BYTE  0                       Hi   | Lo
  1000.                               xxxx | xxxx
  1001.                                           x: X location.
  1002. BYTE  1                       Hi   | Lo
  1003.                               yyyy | yyyy
  1004.                                           y: Y location.
  1005. WORD  2+3         Hi1  | Lo1  | Hi   | Lo
  1006.                   abcd | eeex | xxxx | xxxx
  1007.                                           a: Vertical flip.
  1008.                                           b: Horizontal flip.
  1009.                                           c: Playfield priority.
  1010.                                           d: Playfield priority.
  1011.                                           e: Pallete #.
  1012.                                           x: Character #.
  1013. *** SPRITE 0 ***
  1014. BYTE  4                       Hi   | Lo
  1015.                               xxxx | xxxx
  1016.                                           x: X location.
  1017. BYTE  5                       Hi   | Lo
  1018.                               yyyy | yyyy
  1019.                                           y: Y location.
  1020. ....... and so on .......
  1021. ---------------------------------------------------------------------------
  1022.       Continue this table all the way down to sprite #127 (the 128th
  1023.       sprite).
  1024.       
  1025.       Don't think you're finished yet: There is another table of data
  1026.       you have to make.
  1027.       2 bits are defined for each sprite (ie. Byte #0 holds the info for
  1028.       Sprite #0, #1, #2, and #3). Therefore, 128/4 = 32 bytes of data for
  1029.       this table.
  1030.  
  1031.       The bit-definitions follow ("x" is which bit i'm speaking about).
  1032.       
  1033.       Bit 0 is the MSB of X position bit (0x)
  1034.       Bit 1 is the size-toggle bit (x0). 
  1035.  
  1036.       So the 4 bytes/sprites + the block are put into the OAM table
  1037.       by consecutive writes to the OAM data register. You first should
  1038.       set the OAM address to $0, then shove your data thru it.
  1039.  
  1040.       *** REMEMBER ***. If you don't set the block after the OAM as
  1041.       well, the results can be nasty: All the data for the MSB stuff
  1042.       wouldn't be defined correctly, which would result in your entire
  1043.       sprite-table being silly :-). Have atleast some 0's there or
  1044.       a table which you really want to use in the longrun.
  1045. =-=-=
  1046. 9)    Magicom Disk registers and Memory controller locations.
  1047. -----------                              
  1048.       Do note that i've never used a Magicomm before, and I would
  1049.       strongly recommend not using these unless you know what each 
  1050.       one does for 100% sure. If you're going to write an OS for
  1051.       the SNES, i'll be at your door worshipping you when it
  1052.       comes out :-)
  1053.  
  1054.       The below registers i've never tested, or had tested. If you
  1055.       end up fucking up your drive, it's not my fault. Someone
  1056.       could remap the $C007 Disk Control Register to the +5V pin on the
  1057.       SNES, and you could end up with a fried Magicomm (maybe. I'm not
  1058.       into Electrical Engineering, so i'm probably wrong, but it'd
  1059.       be funny to see what it did :-)).
  1060.  
  1061. Disk Registers:
  1062.  
  1063. Location    Value returned when read         Value inputted when written
  1064. ---------------------------------------------------------------------------
  1065. $C000:      Input Register                          
  1066. $C002:                                       Digital Output Register
  1067. $C004:      Main Status Register                
  1068. $C005:      Data Register                    Data Register
  1069. $C007:      Digital Input Register           Disk Control Register
  1070. $C008:      Parallel Data                    Parallel Data
  1071. $C009:      Parallel Status
  1072. ---------------------------------------------------------------------------
  1073. Memory Controller: $E000 to $E00D (maybe?).
  1074. =-=-=
  1075. 69)   About the author (ME! :-))...
  1076. -----------                              
  1077.       How come everyone probably goes here LAST :-)
  1078.  
  1079.       I'm 16 years old; blonde hair, blue/grey eyes, 5'10" tall, 140
  1080.       pounds. I currently am attending Corvallis High School in
  1081.       Corvallis, Oregon (I'm a senior, believe it or not). I work
  1082.       at the University (Oregon State, not University of Oregon)
  1083.       as a Computer Science apprentice (volunteered there for fun).
  1084.       In my spare time, I enjoy writing 1100+ lines of SNES doc-
  1085.       umentation (just kidding!), programming, biking, sleeping,
  1086.       composing music, drawing (freehand and via mouse), spending
  1087.       time on IRC (YAY!!!), taking care of our CS users, and just
  1088.       being myself. And for those who REALLY care, i'm single (for
  1089.       females; i've already got a boyfriend: I luv ya, Chris!!!).
  1090.  
  1091.       I've been programming in assembly for, oh, 4 years or so now.
  1092.       I also know BASIC, Pascal, a little 680x0asm, C, and 80x86asm.
  1093.  
  1094.       You can reach me many ways:
  1095.             InterNET: yoshi@CSOS.ORST.EDU
  1096.                       yoshi@rush.cc.edu
  1097.                Phone: (503)753-2431
  1098.            SnailMail: Digital Exodus         - All mail bombs
  1099.                       c/o Jeremy Chadwick    - ...
  1100.               ATTN: SNES DIVISION    - will be returned.
  1101.                       33811 Twin Maple Lane  - Money is glady
  1102.                       Corvallis, OR, 97333   - accepted: Thanx :-)
  1103. =-=-=
  1104. FF)   Greetings, Thanx, etc...
  1105. -----------                              
  1106.       Greetings/Comments go out to the following people:
  1107.  
  1108.    *    Maxx Headroom: Heh heh. Does this make me the OFFICIAL SNES
  1109.                        department for Digital Exodus? :-)
  1110.    *              med: Well, here's our document for starting out via
  1111.                        SNES assembly programming.
  1112.    *           IRSMan: About time someone wrote a CORRECT SNES document,
  1113.                        and this time it was me :-)
  1114.    *          TheJazz: A document this is: Maybe NOW you'll move to
  1115.                        California with med and I?
  1116.    *        JackRippr: We need to compare documents, dude. You probably
  1117.                        have information which I don't have, and it'd be
  1118.                        nice to have them all in one document, mmm?
  1119.    *          Souther: I think i'll be using THIS document instead of
  1120.                        "SNES.GFX" and "BLWSNES.DOC" :-) And no, I don't
  1121.                        know MODE 7! SHUTUP! :-)
  1122.    * Section Z-Man &
  1123.                 Ghost: SCHIZZO BEATER! Ghost, stop bringing Jen over
  1124.                        into Z-Mans' trailer. "That's two..." :-)
  1125.    *          M.BiSON: You asked if I knew 65c816asm: I hope this proves
  1126.                        a tiny bit of my knowledge. Need me to write a
  1127.                        damn crack/intro page NOW? :-)
  1128.    *     Rasta Catcha: Gee, I wonder if this document is better than
  1129.                        yours. Maybe we can team up and write a book :-)
  1130.    *       Norman Yen: Thanx for SNESASM, and all those documents!!!!!
  1131.    * All the dorks on
  1132.         rec.games.v.n: Shut the fuck up already! Stop complaining.
  1133.    * Those who mailed
  1134.          me for a doc: This is for you guys!!! (I hope :-))
  1135.    * All the guys on
  1136.        #SNES & #SNES!: YAY!!! PROGRAMMING TIME!!! :-) :-)
  1137.  
  1138. {@8~r~x_{>a|%$}x
  1139. NO CARRIER
  1140.  
  1141. ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1142. Jeremy "Yoshi" Chadwick           |Internet: yoshi@CSOS.ORST.EDU
  1143. LocalSupport-Apprentice for       |Phone: (503) 753-2431
  1144. Computer Science Outreach Services|IRC & UNiX Support (Yoshi on IRC)
  1145. at Oregon State University        |65c816 programmer (IIGS/SNES)
  1146. Opinions expressed may not be those of the CS Outreach Services dept.
  1147.