<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://sneslab.net/mw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Anonimzwx</id>
	<title>SnesLab - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://sneslab.net/mw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Anonimzwx"/>
	<link rel="alternate" type="text/html" href="https://sneslab.net/wiki/Special:Contributions/Anonimzwx"/>
	<updated>2026-04-30T16:58:15Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.5</generator>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Graphics_Format&amp;diff=20817</id>
		<title>Graphics Format</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Graphics_Format&amp;diff=20817"/>
		<updated>2025-03-03T21:03:45Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* 4bpp */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;SNES&#039;&#039;&#039; utilizes &#039;&#039;&#039;indirect color indexing&#039;&#039;&#039; to have multiple graphics storing formats available in its architecture: 2bpp, 3bpp, 4bpp, 8bpp and [[Mode 7]], with 2 and 4bpp being the most commonly used.&lt;br /&gt;
&lt;br /&gt;
== Primer on Indirect Color Indexing ==&lt;br /&gt;
&#039;&#039;&#039;Indexed color&#039;&#039;&#039; is a technique to manage digital images&#039; colors in a limited fashion, in order to save computer memory and file storage, while speeding up display refresh and file transfers.&lt;br /&gt;
&lt;br /&gt;
When an image is encoded in this way, color information is not directly carried by the image pixel data, but is stored in a separate piece of data called a &#039;&#039;&#039;palette&#039;&#039;&#039;: an array of color elements. Every element in the array represents a color, indexed by its position within the array. The individual entries are sometimes known as &#039;&#039;&#039;color registers&#039;&#039;&#039;. The image pixels do not contain the full specification of its color, but only its index in the &#039;&#039;palette&#039;&#039;. This technique is sometimes referred as &#039;&#039;&#039;pseudocolor&#039;&#039;&#039; or &#039;&#039;&#039;indirect color&#039;&#039;&#039;, as colors are addressed indirectly.&lt;br /&gt;
&lt;br /&gt;
== How It Works ==&lt;br /&gt;
Let&#039;s take a 1bpp sprite, one of the invaders of &#039;&#039;Space Invaders&#039;&#039; by Taito, for example.&lt;br /&gt;
[[File:saa03 1bpp.png|frame|center|Credit of picture to georgjz of [https://georgjz.github.io/snesaa03/ Machine Code Construction Yard].]]&lt;br /&gt;
&lt;br /&gt;
Using binary, &#039;&#039;&#039;the pixels index themselves to a palette color&#039;&#039;&#039;. 0 to white, 1 to black. The picture itself is compressed by turning it to binary which is then converted to hex to store in data (11000 of the tip of the head translating to $18, for one).&lt;br /&gt;
&lt;br /&gt;
However, once 2bpp or higher are introduced, bitplanes come along with them.&lt;br /&gt;
&lt;br /&gt;
For instance, take the sprite of Link in [https://www.zeldadungeon.net/wiki/The_Legend_of_Zelda &#039;&#039;The Legend of Zelda&#039;&#039;] for the Nintendo Entertainment System.&lt;br /&gt;
[[File:saa03 2bpp.png|frame|center|Credit of picture to georgjz of [https://georgjz.github.io/snesaa03/ Machine Code Construction Yard].]]&lt;br /&gt;
&lt;br /&gt;
As it is 2bpp (literally two bits per pixel), two bitplanes are used to account for the increase in color (as $03 = #04 = %00000011). Essentially, each byte represents a row, and to get the color index, we have to combine the two. 0 and 0 = transparent in the SNES&#039; case, 0 and 1 = green, so on and so forth.&lt;br /&gt;
&lt;br /&gt;
For 3, 4bpp, the conversion is rather obvious. But the most commonly used are 2 and 4bpp. As an aside, &#039;&#039;&#039;SNES tiles are stored in 8x8&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Data Storage ==&lt;br /&gt;
Due to the ability to swap bits-per-pixel formats, the SNES has the ability to use a mix of Planar and Intertwined data storage, using Planar in Mode 7.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Planar&#039;&#039;&#039;: Each row (i.e., byte) of a bitplane is stored consecutively, starting with the top row of the lowest bitplane; then the same is repeated with each row of the next bitplane.&lt;br /&gt;
* &#039;&#039;&#039;Intertwined&#039;&#039;&#039;: Each pair of bytes consecutively stored represents a row of the sprite with the byte from the lower bitplane being stored first.&lt;br /&gt;
&lt;br /&gt;
In the SNES, the first two planes of an 8x8 tile are always stored first, and once all those are done, the third and fourth get stored.&lt;br /&gt;
&lt;br /&gt;
[[File:saa03 superkai03.png|frame|center|Credit of picture to georgjz of [https://georgjz.github.io/snesaa03/ Machine Code Construction Yard].]]&lt;br /&gt;
&lt;br /&gt;
== Formats ==&lt;br /&gt;
=== 2bpp ===&lt;br /&gt;
&#039;&#039;&#039;Colors Per Tile&#039;&#039;&#039;: 0-3&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Space Used&#039;&#039;&#039;: 2 bits per pixel. 16 bytes per 8x8 tile.&lt;br /&gt;
&lt;br /&gt;
Note: This is a tiled, planar bitmap format. Each pair represents one byte.&amp;lt;br&amp;gt;&lt;br /&gt;
Format:&lt;br /&gt;
   [r0, bp1], [r0, bp2], [r1, bp1], [r1, bp2], [r2, bp1], [r2, bp2], [r3, bp1], [r3, bp2]&lt;br /&gt;
   [r4, bp1], [r4, bp2], [r5, bp1], [r5, bp2], [r6, bp1], [r6, bp2], [r7, bp1], [r7, bp2]&lt;br /&gt;
&lt;br /&gt;
Short Description:&lt;br /&gt;
Bitplanes 1 and 2 are intertwined row by row.&lt;br /&gt;
&lt;br /&gt;
=== 3bpp ===&lt;br /&gt;
&#039;&#039;&#039;Colors Per Tile&#039;&#039;&#039;: 0-7&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Space Used&#039;&#039;&#039;: 3 bits per pixel.  24 bytes for a 8x8 tile.&lt;br /&gt;
&lt;br /&gt;
Note: This is a tiled, planar bitmap format. Each pair represents one byte.&amp;lt;br&amp;gt;&lt;br /&gt;
Format:&lt;br /&gt;
   [r0, bp1], [r0, bp2], [r1, bp1], [r1, bp2], [r2, bp1], [r2, bp2], [r3, bp1], [r3, bp2]&lt;br /&gt;
   [r4, bp1], [r4, bp2], [r5, bp1], [r5, bp2], [r6, bp1], [r6, bp2], [r7, bp1], [r7, bp2]&lt;br /&gt;
   [r0, bp3], [r1, bp3], [r2, bp3], [r3, bp3], [r4, bp3], [r5, bp3], [r6, bp3], [r7, bp3]&lt;br /&gt;
&lt;br /&gt;
Short Description:&lt;br /&gt;
Bitplanes 1 and 2 are stored first, intertwined row by row.  Then the third bitplane is stored row by row. &amp;lt;br&amp;gt;&lt;br /&gt;
This format isn&#039;t used by many games since it&#039;s actually a type of compression, because the SNES doesn&#039;t natively support the 3BPP format.  There is a routine that inserts the fourth bitplane before or while it&#039;s being transferred to VRAM so that it can be used by the SNES.&lt;br /&gt;
&lt;br /&gt;
=== 4bpp ===&lt;br /&gt;
&#039;&#039;&#039;Colors Per Tile&#039;&#039;&#039;: 0-15&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Space Used&#039;&#039;&#039;: 4 bits per pixel.  32 bytes for a 8x8 tile.&lt;br /&gt;
&lt;br /&gt;
Note: This is a tiled, planar bitmap format. Each pair represents one byte&amp;lt;br&amp;gt;&lt;br /&gt;
Format:&lt;br /&gt;
   [r0, bp1], [r0, bp2], [r1, bp1], [r1, bp2], [r2, bp1], [r2, bp2], [r3, bp1], [r3, bp2]&lt;br /&gt;
   [r4, bp1], [r4, bp2], [r5, bp1], [r5, bp2], [r6, bp1], [r6, bp2], [r7, bp1], [r7, bp2]&lt;br /&gt;
   [r0, bp3], [r0, bp4], [r1, bp3], [r1, bp4], [r2, bp3], [r2, bp4], [r3, bp3], [r3, bp4]&lt;br /&gt;
   [r4, bp3], [r4, bp4], [r5, bp3], [r5, bp4], [r6, bp3], [r6, bp4], [r7, bp3], [r7, bp4]&lt;br /&gt;
&lt;br /&gt;
Short Description:&lt;br /&gt;
Bitplanes 1 and 2 are stored first, intertwined row by row.  Then bitplanes 3 and 4 are stored, intertwined row by row.&lt;br /&gt;
&lt;br /&gt;
An algorithm to convert from SNES 4bpp Graphics to a indexed color matrix:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
public static void LoadSNES4bppGFXToIndexedColorMatrix(byte[] src, byte[] dest)&lt;br /&gt;
{&lt;br /&gt;
    byte b0;&lt;br /&gt;
    byte b1;&lt;br /&gt;
    byte b2;&lt;br /&gt;
    byte b3;&lt;br /&gt;
    int res;&lt;br /&gt;
    int mul;&lt;br /&gt;
    int yAdder = 0;&lt;br /&gt;
    int srcIndex;&lt;br /&gt;
    int destX;&lt;br /&gt;
    int destY;&lt;br /&gt;
    int destIndex;&lt;br /&gt;
    int mainIndexLimit = src.length/32;&lt;br /&gt;
    for (int mainIndex = 0; mainIndex &amp;lt;= mainIndexLimit; mainIndex += 32)&lt;br /&gt;
    {&lt;br /&gt;
        srcIndex = (mainIndex &amp;lt;&amp;lt; 5);&lt;br /&gt;
        if (srcIndex + 31 &amp;gt;= src.length)&lt;br /&gt;
            return;&lt;br /&gt;
        destX = index &amp;amp; 0x0F;&lt;br /&gt;
        destY = index &amp;gt;&amp;gt; 4;&lt;br /&gt;
        destIndex = ((destY &amp;lt;&amp;lt; 7) + destX) &amp;lt;&amp;lt; 3;&lt;br /&gt;
        if (destIndex + 903 &amp;gt;= dest.length)&lt;br /&gt;
            return;&lt;br /&gt;
        for (int i = 0; i &amp;lt; 16; i += 2) &lt;br /&gt;
        {&lt;br /&gt;
            mul = 1;&lt;br /&gt;
            b0 = src[srcIndex + i];&lt;br /&gt;
            b1 = src[srcIndex + i + 1];&lt;br /&gt;
            b2 = src[srcIndex + i + 16];&lt;br /&gt;
            b3 = src[srcIndex + i + 17];&lt;br /&gt;
            for (int j = 0; j &amp;lt; 8; j++)&lt;br /&gt;
            {&lt;br /&gt;
                res = ((b0 &amp;amp; mul) | ((b1 &amp;amp; mul) &amp;lt;&amp;lt; 1) | ((b2 &amp;amp; mul) &amp;lt;&amp;lt; 2) | ((b3 &amp;amp; mul) &amp;lt;&amp;lt; 3)) &amp;gt;&amp;gt; j&lt;br /&gt;
                dest[destIndex + (7 - j) + yAdder] = (byte)res;&lt;br /&gt;
                mul &amp;lt;&amp;lt;= 1;&lt;br /&gt;
            }&lt;br /&gt;
            yAdder += 128;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 8bpp ===&lt;br /&gt;
&#039;&#039;&#039;Colors Per Tile&#039;&#039;&#039;: 0-255&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Space Used&#039;&#039;&#039;: 8 bits per pixel.  64 bytes for a 8x8 tile.&lt;br /&gt;
&lt;br /&gt;
Note: This is a tiled, planar bitmap format. Each pair represents one byte&amp;lt;br&amp;gt;&lt;br /&gt;
Format:&lt;br /&gt;
   [r0, bp1], [r0, bp2], [r1, bp1], [r1, bp2], [r2, bp1], [r2, bp2], [r3, bp1], [r3, bp2]&lt;br /&gt;
   [r4, bp1], [r4, bp2], [r5, bp1], [r5, bp2], [r6, bp1], [r6, bp2], [r7, bp1], [r7, bp2]&lt;br /&gt;
   [r0, bp3], [r0, bp4], [r1, bp3], [r1, bp4], [r2, bp3], [r2, bp4], [r3, bp3], [r3, bp4]&lt;br /&gt;
   [r4, bp3], [r4, bp4], [r5, bp3], [r5, bp4], [r6, bp3], [r6, bp4], [r7, bp3], [r7, bp4]&lt;br /&gt;
   [r0, bp5], [r0, bp6], [r1, bp5], [r1, bp6], [r2, bp5], [r2, bp6], [r3, bp5], [r3, bp6]&lt;br /&gt;
   [r4, bp5], [r4, bp6], [r5, bp5], [r5, bp6], [r6, bp5], [r6, bp6], [r7, bp5], [r7, bp6]&lt;br /&gt;
   [r0, bp7], [r0, bp8], [r1, bp7], [r1, bp8], [r2, bp7], [r2, bp8], [r3, bp7], [r3, bp8]&lt;br /&gt;
   [r4, bp7], [r4, bp8], [r5, bp7], [r5, bp8], [r6, bp7], [r6, bp8], [r7, bp7], [r7, bp8]&lt;br /&gt;
&lt;br /&gt;
Short Description:&lt;br /&gt;
Bitplanes 1 and 2 are stored first, intertwined row by row.  Bitplanes 3 and 4 are stored next intertwined row by row.  Then Bitplanes 5 and 6 intertwined row by row.  Finally, Bitplanes 7 and 8 are stored intertwined row by row.&lt;br /&gt;
&lt;br /&gt;
Alternatively and equivalently: In a normal paletted 8x8 image, the bits of pixel data are accessed with byte index yyyxxx and bit index ccc. In SNES 8bpp, the indices are instead ccyyyc xxx.&lt;br /&gt;
&lt;br /&gt;
=== Mode 7 ===&lt;br /&gt;
&#039;&#039;&#039;Colors Per Tile&#039;&#039;&#039;: 0-255&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Space used&#039;&#039;&#039;: 8 bits per pixel.  64 bytes for a 8x8 tile.&lt;br /&gt;
&lt;br /&gt;
Note: This is a tiled, linear bitmap format. Each pair represents 1 byte.&amp;lt;br&amp;gt;&lt;br /&gt;
Format:&lt;br /&gt;
   [p0 r0: bp!], [p1 r0: bp!], [p2 r0: bp!], [p3 r0: bp!]&lt;br /&gt;
   [p4 r0: bp!], [p5 r0: bp!], [p6 r0: bp!], [p7 r0: bp!]&lt;br /&gt;
   [p0 r1: bp!], [p1 r1: bp!], [p2 r1: bp!], [p3 r1: bp!]&lt;br /&gt;
   [p4 r1: bp!], [p5 r1: bp!], [p6 r1: bp!], [p7 r1: bp!]&lt;br /&gt;
   ...&lt;br /&gt;
   [p0 r7: bp!], [p1 r7: bp!], [p2 r7: bp!], [p3 r7: bp!]&lt;br /&gt;
   [p4 r7: bp!], [p5 r7: bp!], [p6 r7: bp!], [p7 r7: bp!]&lt;br /&gt;
&lt;br /&gt;
Short Description:&lt;br /&gt;
Each pixel has its bitplanes stored right after another, so each byte directly references a palette color without needing to &amp;quot;combine&amp;quot; the bitplanes.&lt;br /&gt;
&lt;br /&gt;
== Palette format ==&lt;br /&gt;
The SNES uses a format known as BGR555, rather similar to RGB888. The conversion method is simple, take the five most significant bytes of each color component, and place them backwards (Blue, Green, Red), setting the most significant bit to 0.&lt;br /&gt;
&lt;br /&gt;
[[File:saa03 palette01.png|frame|center|Credit of picture to georgjz of [https://georgjz.github.io/snesaa03/ Machine Code Construction Yard].]]&lt;br /&gt;
&lt;br /&gt;
This gives the SNES the ability to use any color that fits in that spectrum rather than stick to fixed palettes set by the machine.&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
[https://www.youtube.com/watch?v=57ibhDU2SAI Super Nintendo Entertainment System Features, by Retro Game Mechanics Explained]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://mrclick.zophar.net/TilEd/download/consolegfx.txt Klarth&#039;s Console GFX Document]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://georgjz.github.io/snesaa03/ SNES Assembly Adventure, Lesson 03]&lt;br /&gt;
&lt;br /&gt;
[[Category:Video]]&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Graphics_Format&amp;diff=20816</id>
		<title>Graphics Format</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Graphics_Format&amp;diff=20816"/>
		<updated>2025-03-03T21:02:12Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* 4bpp */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;SNES&#039;&#039;&#039; utilizes &#039;&#039;&#039;indirect color indexing&#039;&#039;&#039; to have multiple graphics storing formats available in its architecture: 2bpp, 3bpp, 4bpp, 8bpp and [[Mode 7]], with 2 and 4bpp being the most commonly used.&lt;br /&gt;
&lt;br /&gt;
== Primer on Indirect Color Indexing ==&lt;br /&gt;
&#039;&#039;&#039;Indexed color&#039;&#039;&#039; is a technique to manage digital images&#039; colors in a limited fashion, in order to save computer memory and file storage, while speeding up display refresh and file transfers.&lt;br /&gt;
&lt;br /&gt;
When an image is encoded in this way, color information is not directly carried by the image pixel data, but is stored in a separate piece of data called a &#039;&#039;&#039;palette&#039;&#039;&#039;: an array of color elements. Every element in the array represents a color, indexed by its position within the array. The individual entries are sometimes known as &#039;&#039;&#039;color registers&#039;&#039;&#039;. The image pixels do not contain the full specification of its color, but only its index in the &#039;&#039;palette&#039;&#039;. This technique is sometimes referred as &#039;&#039;&#039;pseudocolor&#039;&#039;&#039; or &#039;&#039;&#039;indirect color&#039;&#039;&#039;, as colors are addressed indirectly.&lt;br /&gt;
&lt;br /&gt;
== How It Works ==&lt;br /&gt;
Let&#039;s take a 1bpp sprite, one of the invaders of &#039;&#039;Space Invaders&#039;&#039; by Taito, for example.&lt;br /&gt;
[[File:saa03 1bpp.png|frame|center|Credit of picture to georgjz of [https://georgjz.github.io/snesaa03/ Machine Code Construction Yard].]]&lt;br /&gt;
&lt;br /&gt;
Using binary, &#039;&#039;&#039;the pixels index themselves to a palette color&#039;&#039;&#039;. 0 to white, 1 to black. The picture itself is compressed by turning it to binary which is then converted to hex to store in data (11000 of the tip of the head translating to $18, for one).&lt;br /&gt;
&lt;br /&gt;
However, once 2bpp or higher are introduced, bitplanes come along with them.&lt;br /&gt;
&lt;br /&gt;
For instance, take the sprite of Link in [https://www.zeldadungeon.net/wiki/The_Legend_of_Zelda &#039;&#039;The Legend of Zelda&#039;&#039;] for the Nintendo Entertainment System.&lt;br /&gt;
[[File:saa03 2bpp.png|frame|center|Credit of picture to georgjz of [https://georgjz.github.io/snesaa03/ Machine Code Construction Yard].]]&lt;br /&gt;
&lt;br /&gt;
As it is 2bpp (literally two bits per pixel), two bitplanes are used to account for the increase in color (as $03 = #04 = %00000011). Essentially, each byte represents a row, and to get the color index, we have to combine the two. 0 and 0 = transparent in the SNES&#039; case, 0 and 1 = green, so on and so forth.&lt;br /&gt;
&lt;br /&gt;
For 3, 4bpp, the conversion is rather obvious. But the most commonly used are 2 and 4bpp. As an aside, &#039;&#039;&#039;SNES tiles are stored in 8x8&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Data Storage ==&lt;br /&gt;
Due to the ability to swap bits-per-pixel formats, the SNES has the ability to use a mix of Planar and Intertwined data storage, using Planar in Mode 7.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Planar&#039;&#039;&#039;: Each row (i.e., byte) of a bitplane is stored consecutively, starting with the top row of the lowest bitplane; then the same is repeated with each row of the next bitplane.&lt;br /&gt;
* &#039;&#039;&#039;Intertwined&#039;&#039;&#039;: Each pair of bytes consecutively stored represents a row of the sprite with the byte from the lower bitplane being stored first.&lt;br /&gt;
&lt;br /&gt;
In the SNES, the first two planes of an 8x8 tile are always stored first, and once all those are done, the third and fourth get stored.&lt;br /&gt;
&lt;br /&gt;
[[File:saa03 superkai03.png|frame|center|Credit of picture to georgjz of [https://georgjz.github.io/snesaa03/ Machine Code Construction Yard].]]&lt;br /&gt;
&lt;br /&gt;
== Formats ==&lt;br /&gt;
=== 2bpp ===&lt;br /&gt;
&#039;&#039;&#039;Colors Per Tile&#039;&#039;&#039;: 0-3&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Space Used&#039;&#039;&#039;: 2 bits per pixel. 16 bytes per 8x8 tile.&lt;br /&gt;
&lt;br /&gt;
Note: This is a tiled, planar bitmap format. Each pair represents one byte.&amp;lt;br&amp;gt;&lt;br /&gt;
Format:&lt;br /&gt;
   [r0, bp1], [r0, bp2], [r1, bp1], [r1, bp2], [r2, bp1], [r2, bp2], [r3, bp1], [r3, bp2]&lt;br /&gt;
   [r4, bp1], [r4, bp2], [r5, bp1], [r5, bp2], [r6, bp1], [r6, bp2], [r7, bp1], [r7, bp2]&lt;br /&gt;
&lt;br /&gt;
Short Description:&lt;br /&gt;
Bitplanes 1 and 2 are intertwined row by row.&lt;br /&gt;
&lt;br /&gt;
=== 3bpp ===&lt;br /&gt;
&#039;&#039;&#039;Colors Per Tile&#039;&#039;&#039;: 0-7&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Space Used&#039;&#039;&#039;: 3 bits per pixel.  24 bytes for a 8x8 tile.&lt;br /&gt;
&lt;br /&gt;
Note: This is a tiled, planar bitmap format. Each pair represents one byte.&amp;lt;br&amp;gt;&lt;br /&gt;
Format:&lt;br /&gt;
   [r0, bp1], [r0, bp2], [r1, bp1], [r1, bp2], [r2, bp1], [r2, bp2], [r3, bp1], [r3, bp2]&lt;br /&gt;
   [r4, bp1], [r4, bp2], [r5, bp1], [r5, bp2], [r6, bp1], [r6, bp2], [r7, bp1], [r7, bp2]&lt;br /&gt;
   [r0, bp3], [r1, bp3], [r2, bp3], [r3, bp3], [r4, bp3], [r5, bp3], [r6, bp3], [r7, bp3]&lt;br /&gt;
&lt;br /&gt;
Short Description:&lt;br /&gt;
Bitplanes 1 and 2 are stored first, intertwined row by row.  Then the third bitplane is stored row by row. &amp;lt;br&amp;gt;&lt;br /&gt;
This format isn&#039;t used by many games since it&#039;s actually a type of compression, because the SNES doesn&#039;t natively support the 3BPP format.  There is a routine that inserts the fourth bitplane before or while it&#039;s being transferred to VRAM so that it can be used by the SNES.&lt;br /&gt;
&lt;br /&gt;
=== 4bpp ===&lt;br /&gt;
&#039;&#039;&#039;Colors Per Tile&#039;&#039;&#039;: 0-15&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Space Used&#039;&#039;&#039;: 4 bits per pixel.  32 bytes for a 8x8 tile.&lt;br /&gt;
&lt;br /&gt;
Note: This is a tiled, planar bitmap format. Each pair represents one byte&amp;lt;br&amp;gt;&lt;br /&gt;
Format:&lt;br /&gt;
   [r0, bp1], [r0, bp2], [r1, bp1], [r1, bp2], [r2, bp1], [r2, bp2], [r3, bp1], [r3, bp2]&lt;br /&gt;
   [r4, bp1], [r4, bp2], [r5, bp1], [r5, bp2], [r6, bp1], [r6, bp2], [r7, bp1], [r7, bp2]&lt;br /&gt;
   [r0, bp3], [r0, bp4], [r1, bp3], [r1, bp4], [r2, bp3], [r2, bp4], [r3, bp3], [r3, bp4]&lt;br /&gt;
   [r4, bp3], [r4, bp4], [r5, bp3], [r5, bp4], [r6, bp3], [r6, bp4], [r7, bp3], [r7, bp4]&lt;br /&gt;
&lt;br /&gt;
Short Description:&lt;br /&gt;
Bitplanes 1 and 2 are stored first, intertwined row by row.  Then bitplanes 3 and 4 are stored, intertwined row by row.&lt;br /&gt;
&lt;br /&gt;
An algorithm to convert from SNES 4bpp Graphics to a indexed color matrix:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        public static void LoadSNES4bppGFXToIndexedColorMatrix(byte[] src, byte[] dest)&lt;br /&gt;
        {&lt;br /&gt;
            byte b0;&lt;br /&gt;
            byte b1;&lt;br /&gt;
            byte b2;&lt;br /&gt;
            byte b3;&lt;br /&gt;
            int res;&lt;br /&gt;
            int mul;&lt;br /&gt;
            int yAdder = 0;&lt;br /&gt;
            int srcIndex;&lt;br /&gt;
            int destX;&lt;br /&gt;
            int destY;&lt;br /&gt;
            int destIndex;&lt;br /&gt;
            int mainIndexLimit = src.length/32;&lt;br /&gt;
            for (int mainIndex = 0; mainIndex &amp;lt;= mainIndexLimit; mainIndex += 32)&lt;br /&gt;
            {&lt;br /&gt;
                srcIndex = (mainIndex &amp;lt;&amp;lt; 5);&lt;br /&gt;
                if (srcIndex + 31 &amp;gt;= src.length)&lt;br /&gt;
                    return;&lt;br /&gt;
                destX = index &amp;amp; 0x0F;&lt;br /&gt;
                destY = index &amp;gt;&amp;gt; 4;&lt;br /&gt;
                destIndex = ((destY &amp;lt;&amp;lt; 7) + destX) &amp;lt;&amp;lt; 3;&lt;br /&gt;
                if (destIndex + 903 &amp;gt;= dest.length)&lt;br /&gt;
                    return;&lt;br /&gt;
                for (int i = 0; i &amp;lt; 16; i += 2) &lt;br /&gt;
                {&lt;br /&gt;
                    mul = 1;&lt;br /&gt;
                    b0 = src[srcIndex + i];&lt;br /&gt;
                    b1 = src[srcIndex + i + 1];&lt;br /&gt;
                    b2 = src[srcIndex + i + 16];&lt;br /&gt;
                    b3 = src[srcIndex + i + 17];&lt;br /&gt;
                    for (int j = 0; j &amp;lt; 8; j++)&lt;br /&gt;
                    {&lt;br /&gt;
                        res = ((b0 &amp;amp; mul) | ((b1 &amp;amp; mul) &amp;lt;&amp;lt; 1) | ((b2 &amp;amp; mul) &amp;lt;&amp;lt; 2) | ((b3 &amp;amp; mul) &amp;lt;&amp;lt; 3)) &amp;gt;&amp;gt; j;&lt;br /&gt;
&lt;br /&gt;
                        dest[destIndex + (7 - j) + yAdder] = (byte)res;&lt;br /&gt;
                        mul &amp;lt;&amp;lt;= 1;&lt;br /&gt;
                    }&lt;br /&gt;
                    yAdder += 128;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 8bpp ===&lt;br /&gt;
&#039;&#039;&#039;Colors Per Tile&#039;&#039;&#039;: 0-255&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Space Used&#039;&#039;&#039;: 8 bits per pixel.  64 bytes for a 8x8 tile.&lt;br /&gt;
&lt;br /&gt;
Note: This is a tiled, planar bitmap format. Each pair represents one byte&amp;lt;br&amp;gt;&lt;br /&gt;
Format:&lt;br /&gt;
   [r0, bp1], [r0, bp2], [r1, bp1], [r1, bp2], [r2, bp1], [r2, bp2], [r3, bp1], [r3, bp2]&lt;br /&gt;
   [r4, bp1], [r4, bp2], [r5, bp1], [r5, bp2], [r6, bp1], [r6, bp2], [r7, bp1], [r7, bp2]&lt;br /&gt;
   [r0, bp3], [r0, bp4], [r1, bp3], [r1, bp4], [r2, bp3], [r2, bp4], [r3, bp3], [r3, bp4]&lt;br /&gt;
   [r4, bp3], [r4, bp4], [r5, bp3], [r5, bp4], [r6, bp3], [r6, bp4], [r7, bp3], [r7, bp4]&lt;br /&gt;
   [r0, bp5], [r0, bp6], [r1, bp5], [r1, bp6], [r2, bp5], [r2, bp6], [r3, bp5], [r3, bp6]&lt;br /&gt;
   [r4, bp5], [r4, bp6], [r5, bp5], [r5, bp6], [r6, bp5], [r6, bp6], [r7, bp5], [r7, bp6]&lt;br /&gt;
   [r0, bp7], [r0, bp8], [r1, bp7], [r1, bp8], [r2, bp7], [r2, bp8], [r3, bp7], [r3, bp8]&lt;br /&gt;
   [r4, bp7], [r4, bp8], [r5, bp7], [r5, bp8], [r6, bp7], [r6, bp8], [r7, bp7], [r7, bp8]&lt;br /&gt;
&lt;br /&gt;
Short Description:&lt;br /&gt;
Bitplanes 1 and 2 are stored first, intertwined row by row.  Bitplanes 3 and 4 are stored next intertwined row by row.  Then Bitplanes 5 and 6 intertwined row by row.  Finally, Bitplanes 7 and 8 are stored intertwined row by row.&lt;br /&gt;
&lt;br /&gt;
Alternatively and equivalently: In a normal paletted 8x8 image, the bits of pixel data are accessed with byte index yyyxxx and bit index ccc. In SNES 8bpp, the indices are instead ccyyyc xxx.&lt;br /&gt;
&lt;br /&gt;
=== Mode 7 ===&lt;br /&gt;
&#039;&#039;&#039;Colors Per Tile&#039;&#039;&#039;: 0-255&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Space used&#039;&#039;&#039;: 8 bits per pixel.  64 bytes for a 8x8 tile.&lt;br /&gt;
&lt;br /&gt;
Note: This is a tiled, linear bitmap format. Each pair represents 1 byte.&amp;lt;br&amp;gt;&lt;br /&gt;
Format:&lt;br /&gt;
   [p0 r0: bp!], [p1 r0: bp!], [p2 r0: bp!], [p3 r0: bp!]&lt;br /&gt;
   [p4 r0: bp!], [p5 r0: bp!], [p6 r0: bp!], [p7 r0: bp!]&lt;br /&gt;
   [p0 r1: bp!], [p1 r1: bp!], [p2 r1: bp!], [p3 r1: bp!]&lt;br /&gt;
   [p4 r1: bp!], [p5 r1: bp!], [p6 r1: bp!], [p7 r1: bp!]&lt;br /&gt;
   ...&lt;br /&gt;
   [p0 r7: bp!], [p1 r7: bp!], [p2 r7: bp!], [p3 r7: bp!]&lt;br /&gt;
   [p4 r7: bp!], [p5 r7: bp!], [p6 r7: bp!], [p7 r7: bp!]&lt;br /&gt;
&lt;br /&gt;
Short Description:&lt;br /&gt;
Each pixel has its bitplanes stored right after another, so each byte directly references a palette color without needing to &amp;quot;combine&amp;quot; the bitplanes.&lt;br /&gt;
&lt;br /&gt;
== Palette format ==&lt;br /&gt;
The SNES uses a format known as BGR555, rather similar to RGB888. The conversion method is simple, take the five most significant bytes of each color component, and place them backwards (Blue, Green, Red), setting the most significant bit to 0.&lt;br /&gt;
&lt;br /&gt;
[[File:saa03 palette01.png|frame|center|Credit of picture to georgjz of [https://georgjz.github.io/snesaa03/ Machine Code Construction Yard].]]&lt;br /&gt;
&lt;br /&gt;
This gives the SNES the ability to use any color that fits in that spectrum rather than stick to fixed palettes set by the machine.&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
[https://www.youtube.com/watch?v=57ibhDU2SAI Super Nintendo Entertainment System Features, by Retro Game Mechanics Explained]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://mrclick.zophar.net/TilEd/download/consolegfx.txt Klarth&#039;s Console GFX Document]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://georgjz.github.io/snesaa03/ SNES Assembly Adventure, Lesson 03]&lt;br /&gt;
&lt;br /&gt;
[[Category:Video]]&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Graphics_Format&amp;diff=20815</id>
		<title>Graphics Format</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Graphics_Format&amp;diff=20815"/>
		<updated>2025-03-03T21:01:02Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* 4bpp */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;SNES&#039;&#039;&#039; utilizes &#039;&#039;&#039;indirect color indexing&#039;&#039;&#039; to have multiple graphics storing formats available in its architecture: 2bpp, 3bpp, 4bpp, 8bpp and [[Mode 7]], with 2 and 4bpp being the most commonly used.&lt;br /&gt;
&lt;br /&gt;
== Primer on Indirect Color Indexing ==&lt;br /&gt;
&#039;&#039;&#039;Indexed color&#039;&#039;&#039; is a technique to manage digital images&#039; colors in a limited fashion, in order to save computer memory and file storage, while speeding up display refresh and file transfers.&lt;br /&gt;
&lt;br /&gt;
When an image is encoded in this way, color information is not directly carried by the image pixel data, but is stored in a separate piece of data called a &#039;&#039;&#039;palette&#039;&#039;&#039;: an array of color elements. Every element in the array represents a color, indexed by its position within the array. The individual entries are sometimes known as &#039;&#039;&#039;color registers&#039;&#039;&#039;. The image pixels do not contain the full specification of its color, but only its index in the &#039;&#039;palette&#039;&#039;. This technique is sometimes referred as &#039;&#039;&#039;pseudocolor&#039;&#039;&#039; or &#039;&#039;&#039;indirect color&#039;&#039;&#039;, as colors are addressed indirectly.&lt;br /&gt;
&lt;br /&gt;
== How It Works ==&lt;br /&gt;
Let&#039;s take a 1bpp sprite, one of the invaders of &#039;&#039;Space Invaders&#039;&#039; by Taito, for example.&lt;br /&gt;
[[File:saa03 1bpp.png|frame|center|Credit of picture to georgjz of [https://georgjz.github.io/snesaa03/ Machine Code Construction Yard].]]&lt;br /&gt;
&lt;br /&gt;
Using binary, &#039;&#039;&#039;the pixels index themselves to a palette color&#039;&#039;&#039;. 0 to white, 1 to black. The picture itself is compressed by turning it to binary which is then converted to hex to store in data (11000 of the tip of the head translating to $18, for one).&lt;br /&gt;
&lt;br /&gt;
However, once 2bpp or higher are introduced, bitplanes come along with them.&lt;br /&gt;
&lt;br /&gt;
For instance, take the sprite of Link in [https://www.zeldadungeon.net/wiki/The_Legend_of_Zelda &#039;&#039;The Legend of Zelda&#039;&#039;] for the Nintendo Entertainment System.&lt;br /&gt;
[[File:saa03 2bpp.png|frame|center|Credit of picture to georgjz of [https://georgjz.github.io/snesaa03/ Machine Code Construction Yard].]]&lt;br /&gt;
&lt;br /&gt;
As it is 2bpp (literally two bits per pixel), two bitplanes are used to account for the increase in color (as $03 = #04 = %00000011). Essentially, each byte represents a row, and to get the color index, we have to combine the two. 0 and 0 = transparent in the SNES&#039; case, 0 and 1 = green, so on and so forth.&lt;br /&gt;
&lt;br /&gt;
For 3, 4bpp, the conversion is rather obvious. But the most commonly used are 2 and 4bpp. As an aside, &#039;&#039;&#039;SNES tiles are stored in 8x8&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Data Storage ==&lt;br /&gt;
Due to the ability to swap bits-per-pixel formats, the SNES has the ability to use a mix of Planar and Intertwined data storage, using Planar in Mode 7.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Planar&#039;&#039;&#039;: Each row (i.e., byte) of a bitplane is stored consecutively, starting with the top row of the lowest bitplane; then the same is repeated with each row of the next bitplane.&lt;br /&gt;
* &#039;&#039;&#039;Intertwined&#039;&#039;&#039;: Each pair of bytes consecutively stored represents a row of the sprite with the byte from the lower bitplane being stored first.&lt;br /&gt;
&lt;br /&gt;
In the SNES, the first two planes of an 8x8 tile are always stored first, and once all those are done, the third and fourth get stored.&lt;br /&gt;
&lt;br /&gt;
[[File:saa03 superkai03.png|frame|center|Credit of picture to georgjz of [https://georgjz.github.io/snesaa03/ Machine Code Construction Yard].]]&lt;br /&gt;
&lt;br /&gt;
== Formats ==&lt;br /&gt;
=== 2bpp ===&lt;br /&gt;
&#039;&#039;&#039;Colors Per Tile&#039;&#039;&#039;: 0-3&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Space Used&#039;&#039;&#039;: 2 bits per pixel. 16 bytes per 8x8 tile.&lt;br /&gt;
&lt;br /&gt;
Note: This is a tiled, planar bitmap format. Each pair represents one byte.&amp;lt;br&amp;gt;&lt;br /&gt;
Format:&lt;br /&gt;
   [r0, bp1], [r0, bp2], [r1, bp1], [r1, bp2], [r2, bp1], [r2, bp2], [r3, bp1], [r3, bp2]&lt;br /&gt;
   [r4, bp1], [r4, bp2], [r5, bp1], [r5, bp2], [r6, bp1], [r6, bp2], [r7, bp1], [r7, bp2]&lt;br /&gt;
&lt;br /&gt;
Short Description:&lt;br /&gt;
Bitplanes 1 and 2 are intertwined row by row.&lt;br /&gt;
&lt;br /&gt;
=== 3bpp ===&lt;br /&gt;
&#039;&#039;&#039;Colors Per Tile&#039;&#039;&#039;: 0-7&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Space Used&#039;&#039;&#039;: 3 bits per pixel.  24 bytes for a 8x8 tile.&lt;br /&gt;
&lt;br /&gt;
Note: This is a tiled, planar bitmap format. Each pair represents one byte.&amp;lt;br&amp;gt;&lt;br /&gt;
Format:&lt;br /&gt;
   [r0, bp1], [r0, bp2], [r1, bp1], [r1, bp2], [r2, bp1], [r2, bp2], [r3, bp1], [r3, bp2]&lt;br /&gt;
   [r4, bp1], [r4, bp2], [r5, bp1], [r5, bp2], [r6, bp1], [r6, bp2], [r7, bp1], [r7, bp2]&lt;br /&gt;
   [r0, bp3], [r1, bp3], [r2, bp3], [r3, bp3], [r4, bp3], [r5, bp3], [r6, bp3], [r7, bp3]&lt;br /&gt;
&lt;br /&gt;
Short Description:&lt;br /&gt;
Bitplanes 1 and 2 are stored first, intertwined row by row.  Then the third bitplane is stored row by row. &amp;lt;br&amp;gt;&lt;br /&gt;
This format isn&#039;t used by many games since it&#039;s actually a type of compression, because the SNES doesn&#039;t natively support the 3BPP format.  There is a routine that inserts the fourth bitplane before or while it&#039;s being transferred to VRAM so that it can be used by the SNES.&lt;br /&gt;
&lt;br /&gt;
=== 4bpp ===&lt;br /&gt;
&#039;&#039;&#039;Colors Per Tile&#039;&#039;&#039;: 0-15&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Space Used&#039;&#039;&#039;: 4 bits per pixel.  32 bytes for a 8x8 tile.&lt;br /&gt;
&lt;br /&gt;
Note: This is a tiled, planar bitmap format. Each pair represents one byte&amp;lt;br&amp;gt;&lt;br /&gt;
Format:&lt;br /&gt;
   [r0, bp1], [r0, bp2], [r1, bp1], [r1, bp2], [r2, bp1], [r2, bp2], [r3, bp1], [r3, bp2]&lt;br /&gt;
   [r4, bp1], [r4, bp2], [r5, bp1], [r5, bp2], [r6, bp1], [r6, bp2], [r7, bp1], [r7, bp2]&lt;br /&gt;
   [r0, bp3], [r0, bp4], [r1, bp3], [r1, bp4], [r2, bp3], [r2, bp4], [r3, bp3], [r3, bp4]&lt;br /&gt;
   [r4, bp3], [r4, bp4], [r5, bp3], [r5, bp4], [r6, bp3], [r6, bp4], [r7, bp3], [r7, bp4]&lt;br /&gt;
&lt;br /&gt;
Short Description:&lt;br /&gt;
Bitplanes 1 and 2 are stored first, intertwined row by row.  Then bitplanes 3 and 4 are stored, intertwined row by row.&lt;br /&gt;
&lt;br /&gt;
An algorithm to convert from SNES 4bpp Graphics to a indexed color matrix:&lt;br /&gt;
&lt;br /&gt;
```&lt;br /&gt;
        public void LoadSNES4bppGFXToIndexedColorMatrix(byte[] src, byte[] dest)&lt;br /&gt;
        {&lt;br /&gt;
            byte b0;&lt;br /&gt;
            byte b1;&lt;br /&gt;
            byte b2;&lt;br /&gt;
            byte b3;&lt;br /&gt;
            int res;&lt;br /&gt;
            int mul;&lt;br /&gt;
            int yAdder = 0;&lt;br /&gt;
            int srcIndex;&lt;br /&gt;
            int destX;&lt;br /&gt;
            int destY;&lt;br /&gt;
            int destIndex;&lt;br /&gt;
            int mainIndexLimit = src.length/32;&lt;br /&gt;
            for (int mainIndex = 0; mainIndex &amp;lt;= mainIndexLimit; mainIndex += 32)&lt;br /&gt;
            {&lt;br /&gt;
                srcIndex = (mainIndex &amp;lt;&amp;lt; 5);&lt;br /&gt;
                if (srcIndex + 31 &amp;gt;= src.length)&lt;br /&gt;
                    return;&lt;br /&gt;
                destX = index &amp;amp; 0x0F;&lt;br /&gt;
                destY = index &amp;gt;&amp;gt; 4;&lt;br /&gt;
                destIndex = ((destY &amp;lt;&amp;lt; 7) + destX) &amp;lt;&amp;lt; 3;&lt;br /&gt;
                if (destIndex + 903 &amp;gt;= dest.length)&lt;br /&gt;
                    return;&lt;br /&gt;
                for (int i = 0; i &amp;lt; 16; i += 2) &lt;br /&gt;
                {&lt;br /&gt;
                    mul = 1;&lt;br /&gt;
                    b0 = src[srcIndex + i];&lt;br /&gt;
                    b1 = src[srcIndex + i + 1];&lt;br /&gt;
                    b2 = src[srcIndex + i + 16];&lt;br /&gt;
                    b3 = src[srcIndex + i + 17];&lt;br /&gt;
                    for (int j = 0; j &amp;lt; 8; j++)&lt;br /&gt;
                    {&lt;br /&gt;
                        res = ((b0 &amp;amp; mul) | ((b1 &amp;amp; mul) &amp;lt;&amp;lt; 1) | ((b2 &amp;amp; mul) &amp;lt;&amp;lt; 2) | ((b3 &amp;amp; mul) &amp;lt;&amp;lt; 3)) &amp;gt;&amp;gt; j;&lt;br /&gt;
&lt;br /&gt;
                        dest[destIndex + (7 - j) + yAdder] = (byte)res;&lt;br /&gt;
                        mul &amp;lt;&amp;lt;= 1;&lt;br /&gt;
                    }&lt;br /&gt;
                    yAdder += 128;&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
```&lt;br /&gt;
&lt;br /&gt;
=== 8bpp ===&lt;br /&gt;
&#039;&#039;&#039;Colors Per Tile&#039;&#039;&#039;: 0-255&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Space Used&#039;&#039;&#039;: 8 bits per pixel.  64 bytes for a 8x8 tile.&lt;br /&gt;
&lt;br /&gt;
Note: This is a tiled, planar bitmap format. Each pair represents one byte&amp;lt;br&amp;gt;&lt;br /&gt;
Format:&lt;br /&gt;
   [r0, bp1], [r0, bp2], [r1, bp1], [r1, bp2], [r2, bp1], [r2, bp2], [r3, bp1], [r3, bp2]&lt;br /&gt;
   [r4, bp1], [r4, bp2], [r5, bp1], [r5, bp2], [r6, bp1], [r6, bp2], [r7, bp1], [r7, bp2]&lt;br /&gt;
   [r0, bp3], [r0, bp4], [r1, bp3], [r1, bp4], [r2, bp3], [r2, bp4], [r3, bp3], [r3, bp4]&lt;br /&gt;
   [r4, bp3], [r4, bp4], [r5, bp3], [r5, bp4], [r6, bp3], [r6, bp4], [r7, bp3], [r7, bp4]&lt;br /&gt;
   [r0, bp5], [r0, bp6], [r1, bp5], [r1, bp6], [r2, bp5], [r2, bp6], [r3, bp5], [r3, bp6]&lt;br /&gt;
   [r4, bp5], [r4, bp6], [r5, bp5], [r5, bp6], [r6, bp5], [r6, bp6], [r7, bp5], [r7, bp6]&lt;br /&gt;
   [r0, bp7], [r0, bp8], [r1, bp7], [r1, bp8], [r2, bp7], [r2, bp8], [r3, bp7], [r3, bp8]&lt;br /&gt;
   [r4, bp7], [r4, bp8], [r5, bp7], [r5, bp8], [r6, bp7], [r6, bp8], [r7, bp7], [r7, bp8]&lt;br /&gt;
&lt;br /&gt;
Short Description:&lt;br /&gt;
Bitplanes 1 and 2 are stored first, intertwined row by row.  Bitplanes 3 and 4 are stored next intertwined row by row.  Then Bitplanes 5 and 6 intertwined row by row.  Finally, Bitplanes 7 and 8 are stored intertwined row by row.&lt;br /&gt;
&lt;br /&gt;
Alternatively and equivalently: In a normal paletted 8x8 image, the bits of pixel data are accessed with byte index yyyxxx and bit index ccc. In SNES 8bpp, the indices are instead ccyyyc xxx.&lt;br /&gt;
&lt;br /&gt;
=== Mode 7 ===&lt;br /&gt;
&#039;&#039;&#039;Colors Per Tile&#039;&#039;&#039;: 0-255&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Space used&#039;&#039;&#039;: 8 bits per pixel.  64 bytes for a 8x8 tile.&lt;br /&gt;
&lt;br /&gt;
Note: This is a tiled, linear bitmap format. Each pair represents 1 byte.&amp;lt;br&amp;gt;&lt;br /&gt;
Format:&lt;br /&gt;
   [p0 r0: bp!], [p1 r0: bp!], [p2 r0: bp!], [p3 r0: bp!]&lt;br /&gt;
   [p4 r0: bp!], [p5 r0: bp!], [p6 r0: bp!], [p7 r0: bp!]&lt;br /&gt;
   [p0 r1: bp!], [p1 r1: bp!], [p2 r1: bp!], [p3 r1: bp!]&lt;br /&gt;
   [p4 r1: bp!], [p5 r1: bp!], [p6 r1: bp!], [p7 r1: bp!]&lt;br /&gt;
   ...&lt;br /&gt;
   [p0 r7: bp!], [p1 r7: bp!], [p2 r7: bp!], [p3 r7: bp!]&lt;br /&gt;
   [p4 r7: bp!], [p5 r7: bp!], [p6 r7: bp!], [p7 r7: bp!]&lt;br /&gt;
&lt;br /&gt;
Short Description:&lt;br /&gt;
Each pixel has its bitplanes stored right after another, so each byte directly references a palette color without needing to &amp;quot;combine&amp;quot; the bitplanes.&lt;br /&gt;
&lt;br /&gt;
== Palette format ==&lt;br /&gt;
The SNES uses a format known as BGR555, rather similar to RGB888. The conversion method is simple, take the five most significant bytes of each color component, and place them backwards (Blue, Green, Red), setting the most significant bit to 0.&lt;br /&gt;
&lt;br /&gt;
[[File:saa03 palette01.png|frame|center|Credit of picture to georgjz of [https://georgjz.github.io/snesaa03/ Machine Code Construction Yard].]]&lt;br /&gt;
&lt;br /&gt;
This gives the SNES the ability to use any color that fits in that spectrum rather than stick to fixed palettes set by the machine.&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
[https://www.youtube.com/watch?v=57ibhDU2SAI Super Nintendo Entertainment System Features, by Retro Game Mechanics Explained]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://mrclick.zophar.net/TilEd/download/consolegfx.txt Klarth&#039;s Console GFX Document]&amp;lt;br&amp;gt;&lt;br /&gt;
[https://georgjz.github.io/snesaa03/ SNES Assembly Adventure, Lesson 03]&lt;br /&gt;
&lt;br /&gt;
[[Category:Video]]&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20764</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20764"/>
		<updated>2025-02-18T22:00:05Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Operaciones Lógicas */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|ASMTutorial}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* &#039;&#039;&#039;Binario:&#039;&#039;&#039; Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #%00001000 (seria el valor 8)&lt;br /&gt;
* &#039;&#039;&#039;Hexadecimal:&#039;&#039;&#039; Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #$10 (sería el valor 16)&lt;br /&gt;
* &#039;&#039;&#039;Decimal:&#039;&#039;&#039; Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* &#039;&#039;&#039;Bank:&#039;&#039;&#039; Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* &#039;&#039;&#039;High Byte:&#039;&#039;&#039; Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* &#039;&#039;&#039;Low Byte:&#039;&#039;&#039; este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* &#039;&#039;&#039;$7E-$7F:&#039;&#039;&#039; son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* &#039;&#039;&#039;$00-$3F:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$80-$CF:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$70-$71:&#039;&#039;&#039; SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* &#039;&#039;&#039;LDA:&#039;&#039;&#039; Guarda un valor en el registro A.&lt;br /&gt;
* &#039;&#039;&#039;LDX:&#039;&#039;&#039; Guarda un valor en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY:&#039;&#039;&#039; Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* &#039;&#039;&#039;STA:&#039;&#039;&#039; Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STX:&#039;&#039;&#039; Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STY:&#039;&#039;&#039; Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STZ:&#039;&#039;&#039; Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* &#039;&#039;&#039;LDX #$A0:&#039;&#039;&#039; Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY $7890:&#039;&#039;&#039; Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* &#039;&#039;&#039;LDA ($00):&#039;&#039;&#039; Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* &#039;&#039;&#039;STX $4567:&#039;&#039;&#039; Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* &#039;&#039;&#039;STA ($00):&#039;&#039;&#039; Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;br /&gt;
&lt;br /&gt;
= Registro de Status y  Operaciones Aritméticas y Lógicas =&lt;br /&gt;
== Registro de Status ==&lt;br /&gt;
El Registro de Status también llamado Registro P, es un registro especial de la SNES, este se encarga de guardar el estado actual de la ALU (Unidad Aritmética Lógica), de acá podemos extraer información que nos puede ayudar en combinación de ciertos comandos, también podemos utilizarlo para que los registro A, X e Y puedan cambiar entre modo de 8 bits y 16 bits.&lt;br /&gt;
El registro P tiene los siguientes bits o flags:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Status Flags&lt;br /&gt;
|-&lt;br /&gt;
! Flag !! Valor !! Descripción&lt;br /&gt;
|-&lt;br /&gt;
| N || #$80 || Si el flag es 1, la última operación dio un resultado con valor negativo. Los números negativos van desde -1 (0xFF) a -128 (0x80), si el valor es 0 entonces el último resultado fue positivo.&lt;br /&gt;
|-&lt;br /&gt;
| V || #$40 || Si el flag es 1, significa que la última operación de forma errónea paso de un número negativo a uno positivo o viceversa, se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|-&lt;br /&gt;
| M || #$20 || Si el flag es 1, significa que el registro A es de 8 bits, sino es de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| X || #$10 || Si el flag es 1, significa que el registro X e Y son de 8 bits, sino son de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| D || #$08 || Si el flag es 1, significa que las operaciones aritméticas se harán como si fuera una operación con números en base 10, sino usa base 16.&lt;br /&gt;
|-&lt;br /&gt;
| I || #$04 || Si el flag es 1, significa que el hardware está en una Interrupción, esto es algo avanzado y se explicará en otro capitulo a futuro.&lt;br /&gt;
|-&lt;br /&gt;
| Z || #$02 || Si el flag es 1, significa que el último resultado de una operación dio el valor cero.&lt;br /&gt;
|-&lt;br /&gt;
| C || #$01 || Si el flag es 1, significa que la última operación superó el límite que el registro podía abarcar, esto se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|}&lt;br /&gt;
Estos serían todos los flags que necesitaremos del registro P.&lt;br /&gt;
Existen 2 comandos especiales para escribir valores en el registro P.&lt;br /&gt;
* &#039;&#039;&#039;REP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 0, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
* &#039;&#039;&#039;SEP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 1, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
Ejemplos de uso:&lt;br /&gt;
* &#039;&#039;&#039;REP #$20:&#039;&#039;&#039; Pone en cero el flag M, por lo tanto haría que el registro A sea de 16 bits.&lt;br /&gt;
* &#039;&#039;&#039;SEP #$20:&#039;&#039;&#039; Pone en 1 el flag M, por lo tanto haría que el registro A sea de 8 bits.&lt;br /&gt;
&lt;br /&gt;
Con los comandos REP y SEP se puede alterar cualquiera de los flags, aunque también existen otros comandos alternativos que pueden hacer lo mismo para algunos flags específicos. Estos son:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;CLV:&#039;&#039;&#039; Pone el Flag V y lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEC y CLC:&#039;&#039;&#039; SEC pone el Flag C en 1 y CLC lo pone  en 0.&lt;br /&gt;
* &#039;&#039;&#039;SED y CLD:&#039;&#039;&#039; SED pone el Flag D en 1 y CLD lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEI y CLI:&#039;&#039;&#039; SEI pone el Flag I en 1 y CLI lo pone en 0.&lt;br /&gt;
&lt;br /&gt;
Estos comandos en general no tienen ninguna ventaja en términos de performance con REP y SEP, aunque pueden servir debido a que usan 1 byte en vez de 2, también es más fácil memorizarlos en general.&lt;br /&gt;
&lt;br /&gt;
=== ¿Qué sucede cuando un registro cambia de 16 a 8 bits? ===&lt;br /&gt;
En el caso del registro A, el High byte del registro queda en el mismo valor que cuando estaba en 16 bits y luego todas las operaciones que hagas serán usando el Low Byte del registro A. Ejemplo si A fuera FC08, al pasarlo a 8 bits, seguiría teniendo el valor FC08, y luego si hicieras algo como LDA #$02, solo cambiaría el Low byte, quedando FC02.&lt;br /&gt;
En el caso del registro X e Y, el High byte pasa a 00 cuando se pasa a 8 bits y luego cualquier operación que se haga afecta solo al Low Byte. Ejemplo, si X fuera FC08, al pasarlo a 8 bits sería 0008, luego si hicieras algo como LDX #$02, solo cambiaría el Low byte, quedando 0002.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Aritméticas ==&lt;br /&gt;
Las operaciones aritméticas nos permiten en la SNES hacer sumas y restas, el Super Nintendo no tiene un comando para hacer multiplicaciones o divisiones, sino que usa un sistema aparte para realizar estas operaciones y que se verán a mayor profundidad en otro capítulo.&lt;br /&gt;
Los comandos aritméticos son:&lt;br /&gt;
* &#039;&#039;&#039;ADC:&#039;&#039;&#039; Suma el valor del registro A con el parámetro del comando, si el flag C es 1, se le añade 1 a la suma.&lt;br /&gt;
* &#039;&#039;&#039;SBC:&#039;&#039;&#039; Resta el valor del registro A con el parámetro del comando, si el flag C es 0, se le resta 1 más a la resta.&lt;br /&gt;
* &#039;&#039;&#039;INC:&#039;&#039;&#039; Incrementa lo que está en el parámetro en 1, INC A incrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;INX, INY:&#039;&#039;&#039; Incrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
* &#039;&#039;&#039;DEC:&#039;&#039;&#039; Decrementa lo que está en el parámetro en 1, INC A Decrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;DEX, DEY:&#039;&#039;&#039; Decrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
&lt;br /&gt;
Todos estos comandos pueden afectar al flag N si es que el resultado es negativo o no y al flag Z si el resultado es cero o no.&lt;br /&gt;
El comando ADC y SBC pueden afectar al flag V y C, la forma en que afectan es:&lt;br /&gt;
* El flag V se activa cuando una operación (suma o resta) que debiera dar un valor negativo, da un valor positivo, o debiera dar un valor positivo, pero da un valor negativo. Por ejemplo:&lt;br /&gt;
** Si al sumar 2 números positivos da un valor negativo, por ejemplo si sumas 0x7F con 0x02, ambos son positivos, pero el resultado es 0x81 que es -127, en este caso se activa el flag V.&lt;br /&gt;
** Si al sumar 2 números negativos se pasa da un valor positivo, por ejemplo si sumas 0x80 con 0xFE, ambos son negativos, pero el resultado da 0x7E que es positivo, en este caso se activa el flag V.&lt;br /&gt;
* El flag C se activa cuando el resultado de una suma da un valor mayor al límite del registro o cuando al hacer una resta, el valor que se resta es mayor que el valor en el registro A. Por ejemplo:&lt;br /&gt;
** A de 8 bits, se suma 0xFE con 0x02, esto da 0x100, pero esto no cabe en 8 bits, así que A seria 0x00 y el flag C se activa.&lt;br /&gt;
** A de 8 bits, a 0x03 se le resta 0x06, esto da 0xFD y activará el flag C.&lt;br /&gt;
&lt;br /&gt;
Para la operación ADC lo recomendable sería antes del comando usar el comando CLC para que no añada 1 extra, en el caso de SBC, lo ideal sería antes del comando usar el comando SEC para que no reste 1 extra. Ejemplos&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA #$01&lt;br /&gt;
CLC&lt;br /&gt;
ADC #$02 ;1 + 2 = 3&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
SEC&lt;br /&gt;
SBC #$01 ;2 - 1 = 1&lt;br /&gt;
&lt;br /&gt;
LDA #$01&lt;br /&gt;
SEC&lt;br /&gt;
ADC #$02 ;1 + 2 + 1 = 4&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
CLC&lt;br /&gt;
SBC #$01 ;2 - 1 - 1 = 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En algunos casos especificos se puede evitar el SEC y SBC. Sobretodo cuando operas números de 16 bits pero con registros de 8 bits.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA !LowByte ;Para este ejemplo !LowByte es 0xFF&lt;br /&gt;
CLC&lt;br /&gt;
ADC #$01&lt;br /&gt;
STA !Result&lt;br /&gt;
&lt;br /&gt;
LDA !HighByte ;Para este ejemplo  !HighByte es 0x01&lt;br /&gt;
ADC #$00&lt;br /&gt;
STA !Result+1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En el ejemplo anterior, se le suma 1 a !LowByte y se guarda en !Result, sin embargo !LowByte es 0xFF así que el resultado debiera dar 0x100, pero A es de 8 bits y no puede almacenar ese número, sin embargo al hacer la suma el flag C se activa y luego podemos sumarle 0 al !HighByte para que de el resultado correcto, al final !Result como variable de 16 bits, tendrá el valor 0x200. Nótese que si la primera suma no hubiera activado el flag C, la segunda suma no haría nada, por lo tanto esto sirve para operar números que tienen un tamaño mayor que el tamaño del registro.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Lógicas ==&lt;br /&gt;
Existen comandos llamados Bitwise, todos estos funcionan aplicando operaciones lógicas bit a bit. Los comandos son los siguientes:&lt;br /&gt;
* &#039;&#039;&#039;AND:&#039;&#039;&#039; Aplica al registro A la operación AND bit a bit con el parámetro del comando.&lt;br /&gt;
* &#039;&#039;&#039;ORA:&#039;&#039;&#039; Aplica al registro A la operación OR bit a bit con el parámetro del comando.&lt;br /&gt;
* &#039;&#039;&#039;EOR:&#039;&#039;&#039; Aplica al registro A la operación Exclusive-OR bit a bit con el parámetro del comando.&lt;br /&gt;
&lt;br /&gt;
Todos los comandos lógicos pueden afectar al flag N y Z. Las tablas de verdad de estos comandos son:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tablas de Verdad comandos AND, ORA y EOR&lt;br /&gt;
|-&lt;br /&gt;
! V1 !! V2 !! V1 AND V2 !! V1 ORA V2 !! V1 EOR V2&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Veamos algunos ejemplos:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA #$13&lt;br /&gt;
AND #$15&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En este caso A tiene el valor 0x13 que en binario es 00010011b y luego se le aplica AND #$15 que en binario es 00010101b, aplicamos la operación AND bit a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00010001b -&amp;gt; V1 AND V2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ahora reemplazando el AND por un ORA:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00010111b -&amp;gt; V1 ORA V2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ahora reemplazando el ORA por un EOR:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00000110b -&amp;gt; V1 EOR V2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En la práctica estos comandos tienen múltiples usos, aunque los más comunes son:&lt;br /&gt;
* &#039;&#039;&#039;AND:&#039;&#039;&#039;&lt;br /&gt;
** Poner en 0 uno o más bits del registro A.&lt;br /&gt;
** Saber si un bit específico está en 1 o no. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
* &#039;&#039;&#039;ORA:&#039;&#039;&#039;&lt;br /&gt;
** Poner en 1 uno o más bits del registro A.&lt;br /&gt;
** Saber si múltiples valores tienen un valor distinto de 0. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
* &#039;&#039;&#039;EOR:&#039;&#039;&#039;&lt;br /&gt;
** Cambiar el valor de uno o más bits del registro A.&lt;br /&gt;
** Saber si un bit específico es igual o distinto a un bit específico del parámetro del comando. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
&lt;br /&gt;
== Operaciones Shift y Rotate ==&lt;br /&gt;
&lt;br /&gt;
Existen algunas operaciones que no es claro catalogarlas como lógicas o aritméticas, sin embargo en algunos casos pueden ser utilizados con estos propósitos. Estos comandos son:&lt;br /&gt;
* &#039;&#039;&#039;ASL:&#039;&#039;&#039; Mueve todos los bits del registro A hacia la izquierda. Ejemplo si tienes 0x02, pasaría a ser 0x04, normalmente se usa para multiplicar por 2, ya que mover los bits a la izquierda en base binaria es multiplicar por 2. Si el valor del registro A es negativo, después de usar este comando, el flag C queda activo.&lt;br /&gt;
* &#039;&#039;&#039;LSR:&#039;&#039;&#039; Mueve todos los bits del registro A hacia la derecha. Ejemplo si tienes 0x02, pasaría a ser 0x01, normalmente se usa para dividir por 2, ya que mover los bits hacia la derecha en base binaria es dividir por 2. Si el valor del registro A es impar, el flag C queda activo.&lt;br /&gt;
* &#039;&#039;&#039;ROL:&#039;&#039;&#039; Similar a ASL pero los bits que estaban prendidos, rotan hacia los bits inferiores. Se explicará en una tabla más adelante.&lt;br /&gt;
* &#039;&#039;&#039;ROR:&#039;&#039;&#039; Similar a LSR pero los bits que estaban prendidos, rotan hacia los bits superiores. Se explicará en una tabla más adelante.&lt;br /&gt;
&lt;br /&gt;
Esta tabla muestra cómo varía el valor 0x01 con el flag C en 0 al aplicar ASL varias veces&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tabla ASL&lt;br /&gt;
|-&lt;br /&gt;
! Veces !! Valor !! Flag C !! B7 !! B6 !! B5 !! B4 !! B3 !! B2 !! B1 !! B0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || #$02 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0&lt;br /&gt;
|-&lt;br /&gt;
| 2 || #$04 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 3 || #$08 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 4 || #$10 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 5 || #$20 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 6 || #$40 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 7 || #$80 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 8 || #$00 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 9 || #$00 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Esta tabla muestra cómo varía el valor 0x80 con el flag C en 0 al aplicar LSR varias veces&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tabla LSR&lt;br /&gt;
|-&lt;br /&gt;
! Veces !! Valor !! Flag C !! B7 !! B6 !! B5 !! B4 !! B3 !! B2 !! B1 !! B0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || #$80 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || #$40 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 2 || #$20 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 3 || #$10 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 4 || #$08 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 5 || #$04 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;1&#039;&#039; || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 6 || #$02 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0&lt;br /&gt;
|-&lt;br /&gt;
| 7 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 8 || #$00 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 9 || #$00 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Esta tabla muestra cómo varía el valor 0x01 con el flag C en 0 al aplicar ROL varias veces&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tabla ROL&lt;br /&gt;
|-&lt;br /&gt;
! Veces !! Valor !! Flag C !! B7 !! B6 !! B5 !! B4 !! B3 !! B2 !! B1 !! B0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || #$02 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0&lt;br /&gt;
|-&lt;br /&gt;
| 2 || #$04 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 3 || #$08 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 4 || #$10 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 5 || #$20 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 6 || #$40 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 7 || #$80 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 8 || #$00 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 9 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Esta tabla muestra cómo varía el valor 0x80 con el flag C en 0 al aplicar ROR varias veces&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tabla ROR&lt;br /&gt;
|-&lt;br /&gt;
! Veces !! Valor !! Flag C !! B7 !! B6 !! B5 !! B4 !! B3 !! B2 !! B1 !! B0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || #$80 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || #$40 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 2 || #$20 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 3 || #$10 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 4 || #$08 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 5 || #$04 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;1&#039;&#039; || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 6 || #$02 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0&lt;br /&gt;
|-&lt;br /&gt;
| 7 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 8 || #$00 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 9 || #$80 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20763</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20763"/>
		<updated>2025-02-18T17:30:38Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Constantes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|ASMTutorial}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* &#039;&#039;&#039;Binario:&#039;&#039;&#039; Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #%00001000 (seria el valor 8)&lt;br /&gt;
* &#039;&#039;&#039;Hexadecimal:&#039;&#039;&#039; Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #$10 (sería el valor 16)&lt;br /&gt;
* &#039;&#039;&#039;Decimal:&#039;&#039;&#039; Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* &#039;&#039;&#039;Bank:&#039;&#039;&#039; Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* &#039;&#039;&#039;High Byte:&#039;&#039;&#039; Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* &#039;&#039;&#039;Low Byte:&#039;&#039;&#039; este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* &#039;&#039;&#039;$7E-$7F:&#039;&#039;&#039; son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* &#039;&#039;&#039;$00-$3F:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$80-$CF:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$70-$71:&#039;&#039;&#039; SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* &#039;&#039;&#039;LDA:&#039;&#039;&#039; Guarda un valor en el registro A.&lt;br /&gt;
* &#039;&#039;&#039;LDX:&#039;&#039;&#039; Guarda un valor en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY:&#039;&#039;&#039; Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* &#039;&#039;&#039;STA:&#039;&#039;&#039; Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STX:&#039;&#039;&#039; Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STY:&#039;&#039;&#039; Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STZ:&#039;&#039;&#039; Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* &#039;&#039;&#039;LDX #$A0:&#039;&#039;&#039; Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY $7890:&#039;&#039;&#039; Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* &#039;&#039;&#039;LDA ($00):&#039;&#039;&#039; Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* &#039;&#039;&#039;STX $4567:&#039;&#039;&#039; Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* &#039;&#039;&#039;STA ($00):&#039;&#039;&#039; Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;br /&gt;
&lt;br /&gt;
= Registro de Status y  Operaciones Aritméticas y Lógicas =&lt;br /&gt;
== Registro de Status ==&lt;br /&gt;
El Registro de Status también llamado Registro P, es un registro especial de la SNES, este se encarga de guardar el estado actual de la ALU (Unidad Aritmética Lógica), de acá podemos extraer información que nos puede ayudar en combinación de ciertos comandos, también podemos utilizarlo para que los registro A, X e Y puedan cambiar entre modo de 8 bits y 16 bits.&lt;br /&gt;
El registro P tiene los siguientes bits o flags:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Status Flags&lt;br /&gt;
|-&lt;br /&gt;
! Flag !! Valor !! Descripción&lt;br /&gt;
|-&lt;br /&gt;
| N || #$80 || Si el flag es 1, la última operación dio un resultado con valor negativo. Los números negativos van desde -1 (0xFF) a -128 (0x80), si el valor es 0 entonces el último resultado fue positivo.&lt;br /&gt;
|-&lt;br /&gt;
| V || #$40 || Si el flag es 1, significa que la última operación de forma errónea paso de un número negativo a uno positivo o viceversa, se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|-&lt;br /&gt;
| M || #$20 || Si el flag es 1, significa que el registro A es de 8 bits, sino es de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| X || #$10 || Si el flag es 1, significa que el registro X e Y son de 8 bits, sino son de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| D || #$08 || Si el flag es 1, significa que las operaciones aritméticas se harán como si fuera una operación con números en base 10, sino usa base 16.&lt;br /&gt;
|-&lt;br /&gt;
| I || #$04 || Si el flag es 1, significa que el hardware está en una Interrupción, esto es algo avanzado y se explicará en otro capitulo a futuro.&lt;br /&gt;
|-&lt;br /&gt;
| Z || #$02 || Si el flag es 1, significa que el último resultado de una operación dio el valor cero.&lt;br /&gt;
|-&lt;br /&gt;
| C || #$01 || Si el flag es 1, significa que la última operación superó el límite que el registro podía abarcar, esto se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|}&lt;br /&gt;
Estos serían todos los flags que necesitaremos del registro P.&lt;br /&gt;
Existen 2 comandos especiales para escribir valores en el registro P.&lt;br /&gt;
* &#039;&#039;&#039;REP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 0, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
* &#039;&#039;&#039;SEP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 1, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
Ejemplos de uso:&lt;br /&gt;
* &#039;&#039;&#039;REP #$20:&#039;&#039;&#039; Pone en cero el flag M, por lo tanto haría que el registro A sea de 16 bits.&lt;br /&gt;
* &#039;&#039;&#039;SEP #$20:&#039;&#039;&#039; Pone en 1 el flag M, por lo tanto haría que el registro A sea de 8 bits.&lt;br /&gt;
&lt;br /&gt;
Con los comandos REP y SEP se puede alterar cualquiera de los flags, aunque también existen otros comandos alternativos que pueden hacer lo mismo para algunos flags específicos. Estos son:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;CLV:&#039;&#039;&#039; Pone el Flag V y lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEC y CLC:&#039;&#039;&#039; SEC pone el Flag C en 1 y CLC lo pone  en 0.&lt;br /&gt;
* &#039;&#039;&#039;SED y CLD:&#039;&#039;&#039; SED pone el Flag D en 1 y CLD lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEI y CLI:&#039;&#039;&#039; SEI pone el Flag I en 1 y CLI lo pone en 0.&lt;br /&gt;
&lt;br /&gt;
Estos comandos en general no tienen ninguna ventaja en términos de performance con REP y SEP, aunque pueden servir debido a que usan 1 byte en vez de 2, también es más fácil memorizarlos en general.&lt;br /&gt;
&lt;br /&gt;
=== ¿Qué sucede cuando un registro cambia de 16 a 8 bits? ===&lt;br /&gt;
En el caso del registro A, el High byte del registro queda en el mismo valor que cuando estaba en 16 bits y luego todas las operaciones que hagas serán usando el Low Byte del registro A. Ejemplo si A fuera FC08, al pasarlo a 8 bits, seguiría teniendo el valor FC08, y luego si hicieras algo como LDA #$02, solo cambiaría el Low byte, quedando FC02.&lt;br /&gt;
En el caso del registro X e Y, el High byte pasa a 00 cuando se pasa a 8 bits y luego cualquier operación que se haga afecta solo al Low Byte. Ejemplo, si X fuera FC08, al pasarlo a 8 bits sería 0008, luego si hicieras algo como LDX #$02, solo cambiaría el Low byte, quedando 0002.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Aritméticas ==&lt;br /&gt;
Las operaciones aritméticas nos permiten en la SNES hacer sumas y restas, el Super Nintendo no tiene un comando para hacer multiplicaciones o divisiones, sino que usa un sistema aparte para realizar estas operaciones y que se verán a mayor profundidad en otro capítulo.&lt;br /&gt;
Los comandos aritméticos son:&lt;br /&gt;
* &#039;&#039;&#039;ADC:&#039;&#039;&#039; Suma el valor del registro A con el parámetro del comando, si el flag C es 1, se le añade 1 a la suma.&lt;br /&gt;
* &#039;&#039;&#039;SBC:&#039;&#039;&#039; Resta el valor del registro A con el parámetro del comando, si el flag C es 0, se le resta 1 más a la resta.&lt;br /&gt;
* &#039;&#039;&#039;INC:&#039;&#039;&#039; Incrementa lo que está en el parámetro en 1, INC A incrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;INX, INY:&#039;&#039;&#039; Incrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
* &#039;&#039;&#039;DEC:&#039;&#039;&#039; Decrementa lo que está en el parámetro en 1, INC A Decrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;DEX, DEY:&#039;&#039;&#039; Decrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
&lt;br /&gt;
Todos estos comandos pueden afectar al flag N si es que el resultado es negativo o no y al flag Z si el resultado es cero o no.&lt;br /&gt;
El comando ADC y SBC pueden afectar al flag V y C, la forma en que afectan es:&lt;br /&gt;
* El flag V se activa cuando una operación (suma o resta) que debiera dar un valor negativo, da un valor positivo, o debiera dar un valor positivo, pero da un valor negativo. Por ejemplo:&lt;br /&gt;
** Si al sumar 2 números positivos da un valor negativo, por ejemplo si sumas 0x7F con 0x02, ambos son positivos, pero el resultado es 0x81 que es -127, en este caso se activa el flag V.&lt;br /&gt;
** Si al sumar 2 números negativos se pasa da un valor positivo, por ejemplo si sumas 0x80 con 0xFE, ambos son negativos, pero el resultado da 0x7E que es positivo, en este caso se activa el flag V.&lt;br /&gt;
* El flag C se activa cuando el resultado de una suma da un valor mayor al límite del registro o cuando al hacer una resta, el valor que se resta es mayor que el valor en el registro A. Por ejemplo:&lt;br /&gt;
** A de 8 bits, se suma 0xFE con 0x02, esto da 0x100, pero esto no cabe en 8 bits, así que A seria 0x00 y el flag C se activa.&lt;br /&gt;
** A de 8 bits, a 0x03 se le resta 0x06, esto da 0xFD y activará el flag C.&lt;br /&gt;
&lt;br /&gt;
Para la operación ADC lo recomendable sería antes del comando usar el comando CLC para que no añada 1 extra, en el caso de SBC, lo ideal sería antes del comando usar el comando SEC para que no reste 1 extra. Ejemplos&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA #$01&lt;br /&gt;
CLC&lt;br /&gt;
ADC #$02 ;1 + 2 = 3&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
SEC&lt;br /&gt;
SBC #$01 ;2 - 1 = 1&lt;br /&gt;
&lt;br /&gt;
LDA #$01&lt;br /&gt;
SEC&lt;br /&gt;
ADC #$02 ;1 + 2 + 1 = 4&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
CLC&lt;br /&gt;
SBC #$01 ;2 - 1 - 1 = 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En algunos casos especificos se puede evitar el SEC y SBC. Sobretodo cuando operas números de 16 bits pero con registros de 8 bits.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA !LowByte ;Para este ejemplo !LowByte es 0xFF&lt;br /&gt;
CLC&lt;br /&gt;
ADC #$01&lt;br /&gt;
STA !Result&lt;br /&gt;
&lt;br /&gt;
LDA !HighByte ;Para este ejemplo  !HighByte es 0x01&lt;br /&gt;
ADC #$00&lt;br /&gt;
STA !Result+1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En el ejemplo anterior, se le suma 1 a !LowByte y se guarda en !Result, sin embargo !LowByte es 0xFF así que el resultado debiera dar 0x100, pero A es de 8 bits y no puede almacenar ese número, sin embargo al hacer la suma el flag C se activa y luego podemos sumarle 0 al !HighByte para que de el resultado correcto, al final !Result como variable de 16 bits, tendrá el valor 0x200. Nótese que si la primera suma no hubiera activado el flag C, la segunda suma no haría nada, por lo tanto esto sirve para operar números que tienen un tamaño mayor que el tamaño del registro.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Lógicas ==&lt;br /&gt;
Existen comandos llamados Bitwise, todos estos funcionan aplicando operaciones lógicas bit a bit. Los comandos son los siguientes:&lt;br /&gt;
* &#039;&#039;&#039;AND:&#039;&#039;&#039; Aplica al registro A la operación AND bit a bit con el parámetro del comando.&lt;br /&gt;
* &#039;&#039;&#039;ORA:&#039;&#039;&#039; Aplica al registro A la operación OR bit a bit con el parámetro del comando.&lt;br /&gt;
* &#039;&#039;&#039;EOR:&#039;&#039;&#039; Aplica al registro A la operación Exclusive-OR bit a bit con el parámetro del comando.&lt;br /&gt;
&lt;br /&gt;
Todos los comandos lógicos pueden afectar al flag N y Z. Las tablas de verdad de estos comandos son:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tablas de Verdad comandos AND, ORA y EOR&lt;br /&gt;
|-&lt;br /&gt;
! V1 !! V2 !! V1 AND V2 !! V1 ORA V2 !! V1 EOR V2&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Veamos algunos ejemplos:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA #$13&lt;br /&gt;
AND #$15&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En este caso A tiene el valor 0x13 que en binario es 00010011b y luego se le aplica AND #$15 que en binario es 00010101b, aplicamos la operación AND bit a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00010001b -&amp;gt; V1 AND V2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ahora reemplazando el AND por un ORA:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00010111b -&amp;gt; V1 ORA V2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ahora reemplazando el ORA por un EOR:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00000110b -&amp;gt; V1 EOR V2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En la práctica estos comandos tienen múltiples usos, aunque los más comunes son:&lt;br /&gt;
* A&#039;&#039;&#039;ND:&#039;&#039;&#039;&lt;br /&gt;
** Poner en 0 uno o más bits del registro A.&lt;br /&gt;
** Saber si un bit específico está en 1 o no. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
* &#039;&#039;&#039;ORA:&#039;&#039;&#039;&lt;br /&gt;
** Poner en 1 uno o más bits del registro A.&lt;br /&gt;
** Saber si múltiples valores tienen un valor distinto de 0. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
* &#039;&#039;&#039;EOR:&#039;&#039;&#039;&lt;br /&gt;
** Cambiar el valor de uno o más bits del registro A.&lt;br /&gt;
** Saber si un bit específico es igual o distinto a un bit específico del parámetro del comando. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
&lt;br /&gt;
== Operaciones Shift y Rotate ==&lt;br /&gt;
&lt;br /&gt;
Existen algunas operaciones que no es claro catalogarlas como lógicas o aritméticas, sin embargo en algunos casos pueden ser utilizados con estos propósitos. Estos comandos son:&lt;br /&gt;
* &#039;&#039;&#039;ASL:&#039;&#039;&#039; Mueve todos los bits del registro A hacia la izquierda. Ejemplo si tienes 0x02, pasaría a ser 0x04, normalmente se usa para multiplicar por 2, ya que mover los bits a la izquierda en base binaria es multiplicar por 2. Si el valor del registro A es negativo, después de usar este comando, el flag C queda activo.&lt;br /&gt;
* &#039;&#039;&#039;LSR:&#039;&#039;&#039; Mueve todos los bits del registro A hacia la derecha. Ejemplo si tienes 0x02, pasaría a ser 0x01, normalmente se usa para dividir por 2, ya que mover los bits hacia la derecha en base binaria es dividir por 2. Si el valor del registro A es impar, el flag C queda activo.&lt;br /&gt;
* &#039;&#039;&#039;ROL:&#039;&#039;&#039; Similar a ASL pero los bits que estaban prendidos, rotan hacia los bits inferiores. Se explicará en una tabla más adelante.&lt;br /&gt;
* &#039;&#039;&#039;ROR:&#039;&#039;&#039; Similar a LSR pero los bits que estaban prendidos, rotan hacia los bits superiores. Se explicará en una tabla más adelante.&lt;br /&gt;
&lt;br /&gt;
Esta tabla muestra cómo varía el valor 0x01 con el flag C en 0 al aplicar ASL varias veces&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tabla ASL&lt;br /&gt;
|-&lt;br /&gt;
! Veces !! Valor !! Flag C !! B7 !! B6 !! B5 !! B4 !! B3 !! B2 !! B1 !! B0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || #$02 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0&lt;br /&gt;
|-&lt;br /&gt;
| 2 || #$04 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 3 || #$08 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 4 || #$10 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 5 || #$20 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 6 || #$40 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 7 || #$80 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 8 || #$00 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 9 || #$00 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Esta tabla muestra cómo varía el valor 0x80 con el flag C en 0 al aplicar LSR varias veces&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tabla LSR&lt;br /&gt;
|-&lt;br /&gt;
! Veces !! Valor !! Flag C !! B7 !! B6 !! B5 !! B4 !! B3 !! B2 !! B1 !! B0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || #$80 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || #$40 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 2 || #$20 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 3 || #$10 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 4 || #$08 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 5 || #$04 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;1&#039;&#039; || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 6 || #$02 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0&lt;br /&gt;
|-&lt;br /&gt;
| 7 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 8 || #$00 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 9 || #$00 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Esta tabla muestra cómo varía el valor 0x01 con el flag C en 0 al aplicar ROL varias veces&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tabla ROL&lt;br /&gt;
|-&lt;br /&gt;
! Veces !! Valor !! Flag C !! B7 !! B6 !! B5 !! B4 !! B3 !! B2 !! B1 !! B0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || #$02 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0&lt;br /&gt;
|-&lt;br /&gt;
| 2 || #$04 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 3 || #$08 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 4 || #$10 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 5 || #$20 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 6 || #$40 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 7 || #$80 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 8 || #$00 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 9 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Esta tabla muestra cómo varía el valor 0x80 con el flag C en 0 al aplicar ROR varias veces&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tabla ROR&lt;br /&gt;
|-&lt;br /&gt;
! Veces !! Valor !! Flag C !! B7 !! B6 !! B5 !! B4 !! B3 !! B2 !! B1 !! B0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || #$80 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || #$40 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 2 || #$20 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 3 || #$10 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 4 || #$08 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 5 || #$04 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;1&#039;&#039; || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 6 || #$02 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0&lt;br /&gt;
|-&lt;br /&gt;
| 7 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 8 || #$00 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 9 || #$80 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20762</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20762"/>
		<updated>2025-02-18T17:29:28Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Operaciones Shift y Rotate */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|ASMTutorial}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* Binario: Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #%00001000 (seria el valor 8)&lt;br /&gt;
* Hexadecimal: Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #$10 (sería el valor 16)&lt;br /&gt;
* Decimal: Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* &#039;&#039;&#039;Bank:&#039;&#039;&#039; Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* &#039;&#039;&#039;High Byte:&#039;&#039;&#039; Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* &#039;&#039;&#039;Low Byte:&#039;&#039;&#039; este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* &#039;&#039;&#039;$7E-$7F:&#039;&#039;&#039; son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* &#039;&#039;&#039;$00-$3F:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$80-$CF:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$70-$71:&#039;&#039;&#039; SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* &#039;&#039;&#039;LDA:&#039;&#039;&#039; Guarda un valor en el registro A.&lt;br /&gt;
* &#039;&#039;&#039;LDX:&#039;&#039;&#039; Guarda un valor en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY:&#039;&#039;&#039; Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* &#039;&#039;&#039;STA:&#039;&#039;&#039; Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STX:&#039;&#039;&#039; Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STY:&#039;&#039;&#039; Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STZ:&#039;&#039;&#039; Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* &#039;&#039;&#039;LDX #$A0:&#039;&#039;&#039; Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY $7890:&#039;&#039;&#039; Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* &#039;&#039;&#039;LDA ($00):&#039;&#039;&#039; Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* &#039;&#039;&#039;STX $4567:&#039;&#039;&#039; Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* &#039;&#039;&#039;STA ($00):&#039;&#039;&#039; Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;br /&gt;
&lt;br /&gt;
= Registro de Status y  Operaciones Aritméticas y Lógicas =&lt;br /&gt;
== Registro de Status ==&lt;br /&gt;
El Registro de Status también llamado Registro P, es un registro especial de la SNES, este se encarga de guardar el estado actual de la ALU (Unidad Aritmética Lógica), de acá podemos extraer información que nos puede ayudar en combinación de ciertos comandos, también podemos utilizarlo para que los registro A, X e Y puedan cambiar entre modo de 8 bits y 16 bits.&lt;br /&gt;
El registro P tiene los siguientes bits o flags:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Status Flags&lt;br /&gt;
|-&lt;br /&gt;
! Flag !! Valor !! Descripción&lt;br /&gt;
|-&lt;br /&gt;
| N || #$80 || Si el flag es 1, la última operación dio un resultado con valor negativo. Los números negativos van desde -1 (0xFF) a -128 (0x80), si el valor es 0 entonces el último resultado fue positivo.&lt;br /&gt;
|-&lt;br /&gt;
| V || #$40 || Si el flag es 1, significa que la última operación de forma errónea paso de un número negativo a uno positivo o viceversa, se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|-&lt;br /&gt;
| M || #$20 || Si el flag es 1, significa que el registro A es de 8 bits, sino es de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| X || #$10 || Si el flag es 1, significa que el registro X e Y son de 8 bits, sino son de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| D || #$08 || Si el flag es 1, significa que las operaciones aritméticas se harán como si fuera una operación con números en base 10, sino usa base 16.&lt;br /&gt;
|-&lt;br /&gt;
| I || #$04 || Si el flag es 1, significa que el hardware está en una Interrupción, esto es algo avanzado y se explicará en otro capitulo a futuro.&lt;br /&gt;
|-&lt;br /&gt;
| Z || #$02 || Si el flag es 1, significa que el último resultado de una operación dio el valor cero.&lt;br /&gt;
|-&lt;br /&gt;
| C || #$01 || Si el flag es 1, significa que la última operación superó el límite que el registro podía abarcar, esto se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|}&lt;br /&gt;
Estos serían todos los flags que necesitaremos del registro P.&lt;br /&gt;
Existen 2 comandos especiales para escribir valores en el registro P.&lt;br /&gt;
* &#039;&#039;&#039;REP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 0, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
* &#039;&#039;&#039;SEP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 1, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
Ejemplos de uso:&lt;br /&gt;
* &#039;&#039;&#039;REP #$20:&#039;&#039;&#039; Pone en cero el flag M, por lo tanto haría que el registro A sea de 16 bits.&lt;br /&gt;
* &#039;&#039;&#039;SEP #$20:&#039;&#039;&#039; Pone en 1 el flag M, por lo tanto haría que el registro A sea de 8 bits.&lt;br /&gt;
&lt;br /&gt;
Con los comandos REP y SEP se puede alterar cualquiera de los flags, aunque también existen otros comandos alternativos que pueden hacer lo mismo para algunos flags específicos. Estos son:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;CLV:&#039;&#039;&#039; Pone el Flag V y lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEC y CLC:&#039;&#039;&#039; SEC pone el Flag C en 1 y CLC lo pone  en 0.&lt;br /&gt;
* &#039;&#039;&#039;SED y CLD:&#039;&#039;&#039; SED pone el Flag D en 1 y CLD lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEI y CLI:&#039;&#039;&#039; SEI pone el Flag I en 1 y CLI lo pone en 0.&lt;br /&gt;
&lt;br /&gt;
Estos comandos en general no tienen ninguna ventaja en términos de performance con REP y SEP, aunque pueden servir debido a que usan 1 byte en vez de 2, también es más fácil memorizarlos en general.&lt;br /&gt;
&lt;br /&gt;
=== ¿Qué sucede cuando un registro cambia de 16 a 8 bits? ===&lt;br /&gt;
En el caso del registro A, el High byte del registro queda en el mismo valor que cuando estaba en 16 bits y luego todas las operaciones que hagas serán usando el Low Byte del registro A. Ejemplo si A fuera FC08, al pasarlo a 8 bits, seguiría teniendo el valor FC08, y luego si hicieras algo como LDA #$02, solo cambiaría el Low byte, quedando FC02.&lt;br /&gt;
En el caso del registro X e Y, el High byte pasa a 00 cuando se pasa a 8 bits y luego cualquier operación que se haga afecta solo al Low Byte. Ejemplo, si X fuera FC08, al pasarlo a 8 bits sería 0008, luego si hicieras algo como LDX #$02, solo cambiaría el Low byte, quedando 0002.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Aritméticas ==&lt;br /&gt;
Las operaciones aritméticas nos permiten en la SNES hacer sumas y restas, el Super Nintendo no tiene un comando para hacer multiplicaciones o divisiones, sino que usa un sistema aparte para realizar estas operaciones y que se verán a mayor profundidad en otro capítulo.&lt;br /&gt;
Los comandos aritméticos son:&lt;br /&gt;
* &#039;&#039;&#039;ADC:&#039;&#039;&#039; Suma el valor del registro A con el parámetro del comando, si el flag C es 1, se le añade 1 a la suma.&lt;br /&gt;
* &#039;&#039;&#039;SBC:&#039;&#039;&#039; Resta el valor del registro A con el parámetro del comando, si el flag C es 0, se le resta 1 más a la resta.&lt;br /&gt;
* &#039;&#039;&#039;INC:&#039;&#039;&#039; Incrementa lo que está en el parámetro en 1, INC A incrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;INX, INY:&#039;&#039;&#039; Incrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
* &#039;&#039;&#039;DEC:&#039;&#039;&#039; Decrementa lo que está en el parámetro en 1, INC A Decrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;DEX, DEY:&#039;&#039;&#039; Decrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
&lt;br /&gt;
Todos estos comandos pueden afectar al flag N si es que el resultado es negativo o no y al flag Z si el resultado es cero o no.&lt;br /&gt;
El comando ADC y SBC pueden afectar al flag V y C, la forma en que afectan es:&lt;br /&gt;
* El flag V se activa cuando una operación (suma o resta) que debiera dar un valor negativo, da un valor positivo, o debiera dar un valor positivo, pero da un valor negativo. Por ejemplo:&lt;br /&gt;
** Si al sumar 2 números positivos da un valor negativo, por ejemplo si sumas 0x7F con 0x02, ambos son positivos, pero el resultado es 0x81 que es -127, en este caso se activa el flag V.&lt;br /&gt;
** Si al sumar 2 números negativos se pasa da un valor positivo, por ejemplo si sumas 0x80 con 0xFE, ambos son negativos, pero el resultado da 0x7E que es positivo, en este caso se activa el flag V.&lt;br /&gt;
* El flag C se activa cuando el resultado de una suma da un valor mayor al límite del registro o cuando al hacer una resta, el valor que se resta es mayor que el valor en el registro A. Por ejemplo:&lt;br /&gt;
** A de 8 bits, se suma 0xFE con 0x02, esto da 0x100, pero esto no cabe en 8 bits, así que A seria 0x00 y el flag C se activa.&lt;br /&gt;
** A de 8 bits, a 0x03 se le resta 0x06, esto da 0xFD y activará el flag C.&lt;br /&gt;
&lt;br /&gt;
Para la operación ADC lo recomendable sería antes del comando usar el comando CLC para que no añada 1 extra, en el caso de SBC, lo ideal sería antes del comando usar el comando SEC para que no reste 1 extra. Ejemplos&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA #$01&lt;br /&gt;
CLC&lt;br /&gt;
ADC #$02 ;1 + 2 = 3&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
SEC&lt;br /&gt;
SBC #$01 ;2 - 1 = 1&lt;br /&gt;
&lt;br /&gt;
LDA #$01&lt;br /&gt;
SEC&lt;br /&gt;
ADC #$02 ;1 + 2 + 1 = 4&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
CLC&lt;br /&gt;
SBC #$01 ;2 - 1 - 1 = 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En algunos casos especificos se puede evitar el SEC y SBC. Sobretodo cuando operas números de 16 bits pero con registros de 8 bits.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA !LowByte ;Para este ejemplo !LowByte es 0xFF&lt;br /&gt;
CLC&lt;br /&gt;
ADC #$01&lt;br /&gt;
STA !Result&lt;br /&gt;
&lt;br /&gt;
LDA !HighByte ;Para este ejemplo  !HighByte es 0x01&lt;br /&gt;
ADC #$00&lt;br /&gt;
STA !Result+1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En el ejemplo anterior, se le suma 1 a !LowByte y se guarda en !Result, sin embargo !LowByte es 0xFF así que el resultado debiera dar 0x100, pero A es de 8 bits y no puede almacenar ese número, sin embargo al hacer la suma el flag C se activa y luego podemos sumarle 0 al !HighByte para que de el resultado correcto, al final !Result como variable de 16 bits, tendrá el valor 0x200. Nótese que si la primera suma no hubiera activado el flag C, la segunda suma no haría nada, por lo tanto esto sirve para operar números que tienen un tamaño mayor que el tamaño del registro.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Lógicas ==&lt;br /&gt;
Existen comandos llamados Bitwise, todos estos funcionan aplicando operaciones lógicas bit a bit. Los comandos son los siguientes:&lt;br /&gt;
* &#039;&#039;&#039;AND:&#039;&#039;&#039; Aplica al registro A la operación AND bit a bit con el parámetro del comando.&lt;br /&gt;
* &#039;&#039;&#039;ORA:&#039;&#039;&#039; Aplica al registro A la operación OR bit a bit con el parámetro del comando.&lt;br /&gt;
* &#039;&#039;&#039;EOR:&#039;&#039;&#039; Aplica al registro A la operación Exclusive-OR bit a bit con el parámetro del comando.&lt;br /&gt;
&lt;br /&gt;
Todos los comandos lógicos pueden afectar al flag N y Z. Las tablas de verdad de estos comandos son:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tablas de Verdad comandos AND, ORA y EOR&lt;br /&gt;
|-&lt;br /&gt;
! V1 !! V2 !! V1 AND V2 !! V1 ORA V2 !! V1 EOR V2&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Veamos algunos ejemplos:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA #$13&lt;br /&gt;
AND #$15&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En este caso A tiene el valor 0x13 que en binario es 00010011b y luego se le aplica AND #$15 que en binario es 00010101b, aplicamos la operación AND bit a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00010001b -&amp;gt; V1 AND V2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ahora reemplazando el AND por un ORA:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00010111b -&amp;gt; V1 ORA V2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ahora reemplazando el ORA por un EOR:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00000110b -&amp;gt; V1 EOR V2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En la práctica estos comandos tienen múltiples usos, aunque los más comunes son:&lt;br /&gt;
* A&#039;&#039;&#039;ND:&#039;&#039;&#039;&lt;br /&gt;
** Poner en 0 uno o más bits del registro A.&lt;br /&gt;
** Saber si un bit específico está en 1 o no. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
* &#039;&#039;&#039;ORA:&#039;&#039;&#039;&lt;br /&gt;
** Poner en 1 uno o más bits del registro A.&lt;br /&gt;
** Saber si múltiples valores tienen un valor distinto de 0. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
* &#039;&#039;&#039;EOR:&#039;&#039;&#039;&lt;br /&gt;
** Cambiar el valor de uno o más bits del registro A.&lt;br /&gt;
** Saber si un bit específico es igual o distinto a un bit específico del parámetro del comando. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
&lt;br /&gt;
== Operaciones Shift y Rotate ==&lt;br /&gt;
&lt;br /&gt;
Existen algunas operaciones que no es claro catalogarlas como lógicas o aritméticas, sin embargo en algunos casos pueden ser utilizados con estos propósitos. Estos comandos son:&lt;br /&gt;
* &#039;&#039;&#039;ASL:&#039;&#039;&#039; Mueve todos los bits del registro A hacia la izquierda. Ejemplo si tienes 0x02, pasaría a ser 0x04, normalmente se usa para multiplicar por 2, ya que mover los bits a la izquierda en base binaria es multiplicar por 2. Si el valor del registro A es negativo, después de usar este comando, el flag C queda activo.&lt;br /&gt;
* &#039;&#039;&#039;LSR:&#039;&#039;&#039; Mueve todos los bits del registro A hacia la derecha. Ejemplo si tienes 0x02, pasaría a ser 0x01, normalmente se usa para dividir por 2, ya que mover los bits hacia la derecha en base binaria es dividir por 2. Si el valor del registro A es impar, el flag C queda activo.&lt;br /&gt;
* &#039;&#039;&#039;ROL:&#039;&#039;&#039; Similar a ASL pero los bits que estaban prendidos, rotan hacia los bits inferiores. Se explicará en una tabla más adelante.&lt;br /&gt;
* &#039;&#039;&#039;ROR:&#039;&#039;&#039; Similar a LSR pero los bits que estaban prendidos, rotan hacia los bits superiores. Se explicará en una tabla más adelante.&lt;br /&gt;
&lt;br /&gt;
Esta tabla muestra cómo varía el valor 0x01 con el flag C en 0 al aplicar ASL varias veces&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tabla ASL&lt;br /&gt;
|-&lt;br /&gt;
! Veces !! Valor !! Flag C !! B7 !! B6 !! B5 !! B4 !! B3 !! B2 !! B1 !! B0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || #$02 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0&lt;br /&gt;
|-&lt;br /&gt;
| 2 || #$04 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 3 || #$08 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 4 || #$10 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 5 || #$20 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 6 || #$40 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 7 || #$80 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 8 || #$00 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 9 || #$00 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Esta tabla muestra cómo varía el valor 0x80 con el flag C en 0 al aplicar LSR varias veces&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tabla LSR&lt;br /&gt;
|-&lt;br /&gt;
! Veces !! Valor !! Flag C !! B7 !! B6 !! B5 !! B4 !! B3 !! B2 !! B1 !! B0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || #$80 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || #$40 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 2 || #$20 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 3 || #$10 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 4 || #$08 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 5 || #$04 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;1&#039;&#039; || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 6 || #$02 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0&lt;br /&gt;
|-&lt;br /&gt;
| 7 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 8 || #$00 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 9 || #$00 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Esta tabla muestra cómo varía el valor 0x01 con el flag C en 0 al aplicar ROL varias veces&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tabla ROL&lt;br /&gt;
|-&lt;br /&gt;
! Veces !! Valor !! Flag C !! B7 !! B6 !! B5 !! B4 !! B3 !! B2 !! B1 !! B0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 1 || #$02 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0&lt;br /&gt;
|-&lt;br /&gt;
| 2 || #$04 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 3 || #$08 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 4 || #$10 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 5 || #$20 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 6 || #$40 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 7 || #$80 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 8 || #$00 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 9 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Esta tabla muestra cómo varía el valor 0x80 con el flag C en 0 al aplicar ROR varias veces&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tabla ROR&lt;br /&gt;
|-&lt;br /&gt;
! Veces !! Valor !! Flag C !! B7 !! B6 !! B5 !! B4 !! B3 !! B2 !! B1 !! B0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || #$80 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || #$40 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 2 || #$20 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 3 || #$10 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 4 || #$08 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 5 || #$04 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;1&#039;&#039; || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 6 || #$02 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0&lt;br /&gt;
|-&lt;br /&gt;
| 7 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| 8 || #$00 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 9 || #$80 || 0 || &#039;&#039;&#039;1&#039;&#039;&#039; || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20761</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20761"/>
		<updated>2025-02-18T17:26:27Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Operaciones Shift y Rotate */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|ASMTutorial}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* Binario: Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #%00001000 (seria el valor 8)&lt;br /&gt;
* Hexadecimal: Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #$10 (sería el valor 16)&lt;br /&gt;
* Decimal: Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* &#039;&#039;&#039;Bank:&#039;&#039;&#039; Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* &#039;&#039;&#039;High Byte:&#039;&#039;&#039; Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* &#039;&#039;&#039;Low Byte:&#039;&#039;&#039; este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* &#039;&#039;&#039;$7E-$7F:&#039;&#039;&#039; son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* &#039;&#039;&#039;$00-$3F:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$80-$CF:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$70-$71:&#039;&#039;&#039; SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* &#039;&#039;&#039;LDA:&#039;&#039;&#039; Guarda un valor en el registro A.&lt;br /&gt;
* &#039;&#039;&#039;LDX:&#039;&#039;&#039; Guarda un valor en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY:&#039;&#039;&#039; Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* &#039;&#039;&#039;STA:&#039;&#039;&#039; Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STX:&#039;&#039;&#039; Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STY:&#039;&#039;&#039; Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STZ:&#039;&#039;&#039; Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* &#039;&#039;&#039;LDX #$A0:&#039;&#039;&#039; Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY $7890:&#039;&#039;&#039; Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* &#039;&#039;&#039;LDA ($00):&#039;&#039;&#039; Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* &#039;&#039;&#039;STX $4567:&#039;&#039;&#039; Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* &#039;&#039;&#039;STA ($00):&#039;&#039;&#039; Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;br /&gt;
&lt;br /&gt;
= Registro de Status y  Operaciones Aritméticas y Lógicas =&lt;br /&gt;
== Registro de Status ==&lt;br /&gt;
El Registro de Status también llamado Registro P, es un registro especial de la SNES, este se encarga de guardar el estado actual de la ALU (Unidad Aritmética Lógica), de acá podemos extraer información que nos puede ayudar en combinación de ciertos comandos, también podemos utilizarlo para que los registro A, X e Y puedan cambiar entre modo de 8 bits y 16 bits.&lt;br /&gt;
El registro P tiene los siguientes bits o flags:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Status Flags&lt;br /&gt;
|-&lt;br /&gt;
! Flag !! Valor !! Descripción&lt;br /&gt;
|-&lt;br /&gt;
| N || #$80 || Si el flag es 1, la última operación dio un resultado con valor negativo. Los números negativos van desde -1 (0xFF) a -128 (0x80), si el valor es 0 entonces el último resultado fue positivo.&lt;br /&gt;
|-&lt;br /&gt;
| V || #$40 || Si el flag es 1, significa que la última operación de forma errónea paso de un número negativo a uno positivo o viceversa, se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|-&lt;br /&gt;
| M || #$20 || Si el flag es 1, significa que el registro A es de 8 bits, sino es de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| X || #$10 || Si el flag es 1, significa que el registro X e Y son de 8 bits, sino son de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| D || #$08 || Si el flag es 1, significa que las operaciones aritméticas se harán como si fuera una operación con números en base 10, sino usa base 16.&lt;br /&gt;
|-&lt;br /&gt;
| I || #$04 || Si el flag es 1, significa que el hardware está en una Interrupción, esto es algo avanzado y se explicará en otro capitulo a futuro.&lt;br /&gt;
|-&lt;br /&gt;
| Z || #$02 || Si el flag es 1, significa que el último resultado de una operación dio el valor cero.&lt;br /&gt;
|-&lt;br /&gt;
| C || #$01 || Si el flag es 1, significa que la última operación superó el límite que el registro podía abarcar, esto se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|}&lt;br /&gt;
Estos serían todos los flags que necesitaremos del registro P.&lt;br /&gt;
Existen 2 comandos especiales para escribir valores en el registro P.&lt;br /&gt;
* &#039;&#039;&#039;REP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 0, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
* &#039;&#039;&#039;SEP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 1, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
Ejemplos de uso:&lt;br /&gt;
* &#039;&#039;&#039;REP #$20:&#039;&#039;&#039; Pone en cero el flag M, por lo tanto haría que el registro A sea de 16 bits.&lt;br /&gt;
* &#039;&#039;&#039;SEP #$20:&#039;&#039;&#039; Pone en 1 el flag M, por lo tanto haría que el registro A sea de 8 bits.&lt;br /&gt;
&lt;br /&gt;
Con los comandos REP y SEP se puede alterar cualquiera de los flags, aunque también existen otros comandos alternativos que pueden hacer lo mismo para algunos flags específicos. Estos son:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;CLV:&#039;&#039;&#039; Pone el Flag V y lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEC y CLC:&#039;&#039;&#039; SEC pone el Flag C en 1 y CLC lo pone  en 0.&lt;br /&gt;
* &#039;&#039;&#039;SED y CLD:&#039;&#039;&#039; SED pone el Flag D en 1 y CLD lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEI y CLI:&#039;&#039;&#039; SEI pone el Flag I en 1 y CLI lo pone en 0.&lt;br /&gt;
&lt;br /&gt;
Estos comandos en general no tienen ninguna ventaja en términos de performance con REP y SEP, aunque pueden servir debido a que usan 1 byte en vez de 2, también es más fácil memorizarlos en general.&lt;br /&gt;
&lt;br /&gt;
=== ¿Qué sucede cuando un registro cambia de 16 a 8 bits? ===&lt;br /&gt;
En el caso del registro A, el High byte del registro queda en el mismo valor que cuando estaba en 16 bits y luego todas las operaciones que hagas serán usando el Low Byte del registro A. Ejemplo si A fuera FC08, al pasarlo a 8 bits, seguiría teniendo el valor FC08, y luego si hicieras algo como LDA #$02, solo cambiaría el Low byte, quedando FC02.&lt;br /&gt;
En el caso del registro X e Y, el High byte pasa a 00 cuando se pasa a 8 bits y luego cualquier operación que se haga afecta solo al Low Byte. Ejemplo, si X fuera FC08, al pasarlo a 8 bits sería 0008, luego si hicieras algo como LDX #$02, solo cambiaría el Low byte, quedando 0002.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Aritméticas ==&lt;br /&gt;
Las operaciones aritméticas nos permiten en la SNES hacer sumas y restas, el Super Nintendo no tiene un comando para hacer multiplicaciones o divisiones, sino que usa un sistema aparte para realizar estas operaciones y que se verán a mayor profundidad en otro capítulo.&lt;br /&gt;
Los comandos aritméticos son:&lt;br /&gt;
* &#039;&#039;&#039;ADC:&#039;&#039;&#039; Suma el valor del registro A con el parámetro del comando, si el flag C es 1, se le añade 1 a la suma.&lt;br /&gt;
* &#039;&#039;&#039;SBC:&#039;&#039;&#039; Resta el valor del registro A con el parámetro del comando, si el flag C es 0, se le resta 1 más a la resta.&lt;br /&gt;
* &#039;&#039;&#039;INC:&#039;&#039;&#039; Incrementa lo que está en el parámetro en 1, INC A incrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;INX, INY:&#039;&#039;&#039; Incrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
* &#039;&#039;&#039;DEC:&#039;&#039;&#039; Decrementa lo que está en el parámetro en 1, INC A Decrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;DEX, DEY:&#039;&#039;&#039; Decrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
&lt;br /&gt;
Todos estos comandos pueden afectar al flag N si es que el resultado es negativo o no y al flag Z si el resultado es cero o no.&lt;br /&gt;
El comando ADC y SBC pueden afectar al flag V y C, la forma en que afectan es:&lt;br /&gt;
* El flag V se activa cuando una operación (suma o resta) que debiera dar un valor negativo, da un valor positivo, o debiera dar un valor positivo, pero da un valor negativo. Por ejemplo:&lt;br /&gt;
** Si al sumar 2 números positivos da un valor negativo, por ejemplo si sumas 0x7F con 0x02, ambos son positivos, pero el resultado es 0x81 que es -127, en este caso se activa el flag V.&lt;br /&gt;
** Si al sumar 2 números negativos se pasa da un valor positivo, por ejemplo si sumas 0x80 con 0xFE, ambos son negativos, pero el resultado da 0x7E que es positivo, en este caso se activa el flag V.&lt;br /&gt;
* El flag C se activa cuando el resultado de una suma da un valor mayor al límite del registro o cuando al hacer una resta, el valor que se resta es mayor que el valor en el registro A. Por ejemplo:&lt;br /&gt;
** A de 8 bits, se suma 0xFE con 0x02, esto da 0x100, pero esto no cabe en 8 bits, así que A seria 0x00 y el flag C se activa.&lt;br /&gt;
** A de 8 bits, a 0x03 se le resta 0x06, esto da 0xFD y activará el flag C.&lt;br /&gt;
&lt;br /&gt;
Para la operación ADC lo recomendable sería antes del comando usar el comando CLC para que no añada 1 extra, en el caso de SBC, lo ideal sería antes del comando usar el comando SEC para que no reste 1 extra. Ejemplos&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA #$01&lt;br /&gt;
CLC&lt;br /&gt;
ADC #$02 ;1 + 2 = 3&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
SEC&lt;br /&gt;
SBC #$01 ;2 - 1 = 1&lt;br /&gt;
&lt;br /&gt;
LDA #$01&lt;br /&gt;
SEC&lt;br /&gt;
ADC #$02 ;1 + 2 + 1 = 4&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
CLC&lt;br /&gt;
SBC #$01 ;2 - 1 - 1 = 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En algunos casos especificos se puede evitar el SEC y SBC. Sobretodo cuando operas números de 16 bits pero con registros de 8 bits.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA !LowByte ;Para este ejemplo !LowByte es 0xFF&lt;br /&gt;
CLC&lt;br /&gt;
ADC #$01&lt;br /&gt;
STA !Result&lt;br /&gt;
&lt;br /&gt;
LDA !HighByte ;Para este ejemplo  !HighByte es 0x01&lt;br /&gt;
ADC #$00&lt;br /&gt;
STA !Result+1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En el ejemplo anterior, se le suma 1 a !LowByte y se guarda en !Result, sin embargo !LowByte es 0xFF así que el resultado debiera dar 0x100, pero A es de 8 bits y no puede almacenar ese número, sin embargo al hacer la suma el flag C se activa y luego podemos sumarle 0 al !HighByte para que de el resultado correcto, al final !Result como variable de 16 bits, tendrá el valor 0x200. Nótese que si la primera suma no hubiera activado el flag C, la segunda suma no haría nada, por lo tanto esto sirve para operar números que tienen un tamaño mayor que el tamaño del registro.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Lógicas ==&lt;br /&gt;
Existen comandos llamados Bitwise, todos estos funcionan aplicando operaciones lógicas bit a bit. Los comandos son los siguientes:&lt;br /&gt;
* &#039;&#039;&#039;AND:&#039;&#039;&#039; Aplica al registro A la operación AND bit a bit con el parámetro del comando.&lt;br /&gt;
* &#039;&#039;&#039;ORA:&#039;&#039;&#039; Aplica al registro A la operación OR bit a bit con el parámetro del comando.&lt;br /&gt;
* &#039;&#039;&#039;EOR:&#039;&#039;&#039; Aplica al registro A la operación Exclusive-OR bit a bit con el parámetro del comando.&lt;br /&gt;
&lt;br /&gt;
Todos los comandos lógicos pueden afectar al flag N y Z. Las tablas de verdad de estos comandos son:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tablas de Verdad comandos AND, ORA y EOR&lt;br /&gt;
|-&lt;br /&gt;
! V1 !! V2 !! V1 AND V2 !! V1 ORA V2 !! V1 EOR V2&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Veamos algunos ejemplos:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA #$13&lt;br /&gt;
AND #$15&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En este caso A tiene el valor 0x13 que en binario es 00010011b y luego se le aplica AND #$15 que en binario es 00010101b, aplicamos la operación AND bit a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00010001b -&amp;gt; V1 AND V2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ahora reemplazando el AND por un ORA:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00010111b -&amp;gt; V1 ORA V2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ahora reemplazando el ORA por un EOR:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00000110b -&amp;gt; V1 EOR V2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En la práctica estos comandos tienen múltiples usos, aunque los más comunes son:&lt;br /&gt;
* A&#039;&#039;&#039;ND:&#039;&#039;&#039;&lt;br /&gt;
** Poner en 0 uno o más bits del registro A.&lt;br /&gt;
** Saber si un bit específico está en 1 o no. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
* &#039;&#039;&#039;ORA:&#039;&#039;&#039;&lt;br /&gt;
** Poner en 1 uno o más bits del registro A.&lt;br /&gt;
** Saber si múltiples valores tienen un valor distinto de 0. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
* &#039;&#039;&#039;EOR:&#039;&#039;&#039;&lt;br /&gt;
** Cambiar el valor de uno o más bits del registro A.&lt;br /&gt;
** Saber si un bit específico es igual o distinto a un bit específico del parámetro del comando. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
&lt;br /&gt;
== Operaciones Shift y Rotate ==&lt;br /&gt;
&lt;br /&gt;
Existen algunas operaciones que no es claro catalogarlas como lógicas o aritméticas, sin embargo en algunos casos pueden ser utilizados con estos propósitos. Estos comandos son:&lt;br /&gt;
* &#039;&#039;&#039;ASL:&#039;&#039;&#039; Mueve todos los bits del registro A hacia la izquierda. Ejemplo si tienes 0x02, pasaría a ser 0x04, normalmente se usa para multiplicar por 2, ya que mover los bits a la izquierda en base binaria es multiplicar por 2. Si el valor del registro A es negativo, después de usar este comando, el flag C queda activo.&lt;br /&gt;
* &#039;&#039;&#039;LSR:&#039;&#039;&#039; Mueve todos los bits del registro A hacia la derecha. Ejemplo si tienes 0x02, pasaría a ser 0x01, normalmente se usa para dividir por 2, ya que mover los bits hacia la derecha en base binaria es dividir por 2. Si el valor del registro A es impar, el flag C queda activo.&lt;br /&gt;
* &#039;&#039;&#039;ROL:&#039;&#039;&#039; Similar a ASL pero los bits que estaban prendidos, rotan hacia los bits inferiores. Se explicará en una tabla más adelante.&lt;br /&gt;
* &#039;&#039;&#039;ROR:&#039;&#039;&#039; Similar a LSR pero los bits que estaban prendidos, rotan hacia los bits superiores. Se explicará en una tabla más adelante.&lt;br /&gt;
&lt;br /&gt;
Esta tabla muestra cómo varía el valor 0x01 con el flag C en 0 al aplicar ASL varias veces&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tabla ASL&lt;br /&gt;
|-&lt;br /&gt;
! Veces !! Valor !! Flag C !! B7 !! B6 !! B5 !! B4 !! B3 !! B2 !! B1 !! B0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || #$02 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 2 || #$04 || 0 || 0 || 0 || 0 || 0 || 0 || 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 3 || #$08 || 0 || 0 || 0 || 0 || 0 || 1 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 4 || #$10 || 0 || 0 || 0 || 0 || 1 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 5 || #$20 || 0 || 0 || 0 || 1 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 6 || #$40 || 0 || 0 || 1 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 7 || #$80 || 0 || 1 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 8 || #$00 || 1 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 9 || #$00 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Esta tabla muestra cómo varía el valor 0x80 con el flag C en 0 al aplicar LSR varias veces&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tabla LSR&lt;br /&gt;
|-&lt;br /&gt;
! Veces !! Valor !! Flag C !! B7 !! B6 !! B5 !! B4 !! B3 !! B2 !! B1 !! B0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || #$80 || 0 || 1 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || #$40 || 0 || 0 || 1 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 2 || #$20 || 0 || 0 || 0 || 1 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 3 || #$10 || 0 || 0 || 0 || 0 || 1 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 4 || #$08 || 0 || 0 || 0 || 0 || 0 || 1 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 5 || #$04 || 0 || 0 || 0 || 0 || 0 || 0 || 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 6 || #$02 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 7 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 8 || #$00 || 1 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 9 || #$00 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Esta tabla muestra cómo varía el valor 0x01 con el flag C en 0 al aplicar ROL varias veces&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tabla ROL&lt;br /&gt;
|-&lt;br /&gt;
! Veces !! Valor !! Flag C !! B7 !! B6 !! B5 !! B4 !! B3 !! B2 !! B1 !! B0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || #$02 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 2 || #$04 || 0 || 0 || 0 || 0 || 0 || 0 || 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 3 || #$08 || 0 || 0 || 0 || 0 || 0 || 1 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 4 || #$10 || 0 || 0 || 0 || 0 || 1 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 5 || #$20 || 0 || 0 || 0 || 1 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 6 || #$40 || 0 || 0 || 1 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 7 || #$80 || 0 || 1 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 8 || #$00 || 1 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 9 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Esta tabla muestra cómo varía el valor 0x80 con el flag C en 0 al aplicar ROR varias veces&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tabla ROR&lt;br /&gt;
|-&lt;br /&gt;
! Veces !! Valor !! Flag C !! B7 !! B6 !! B5 !! B4 !! B3 !! B2 !! B1 !! B0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || #$80 || 0 || 1 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || #$40 || 0 || 0 || 1 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 2 || #$20 || 0 || 0 || 0 || 1 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 3 || #$10 || 0 || 0 || 0 || 0 || 1 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 4 || #$08 || 0 || 0 || 0 || 0 || 0 || 1 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 5 || #$04 || 0 || 0 || 0 || 0 || 0 || 0 || 1 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 6 || #$02 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 7 || #$01 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 8 || #$00 || 1 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 9 || #$80 || 0 || 1 || 0 || 0 || 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20760</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20760"/>
		<updated>2025-02-18T17:15:21Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Operaciones Lógicas */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|ASMTutorial}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* Binario: Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #%00001000 (seria el valor 8)&lt;br /&gt;
* Hexadecimal: Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #$10 (sería el valor 16)&lt;br /&gt;
* Decimal: Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* &#039;&#039;&#039;Bank:&#039;&#039;&#039; Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* &#039;&#039;&#039;High Byte:&#039;&#039;&#039; Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* &#039;&#039;&#039;Low Byte:&#039;&#039;&#039; este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* &#039;&#039;&#039;$7E-$7F:&#039;&#039;&#039; son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* &#039;&#039;&#039;$00-$3F:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$80-$CF:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$70-$71:&#039;&#039;&#039; SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* &#039;&#039;&#039;LDA:&#039;&#039;&#039; Guarda un valor en el registro A.&lt;br /&gt;
* &#039;&#039;&#039;LDX:&#039;&#039;&#039; Guarda un valor en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY:&#039;&#039;&#039; Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* &#039;&#039;&#039;STA:&#039;&#039;&#039; Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STX:&#039;&#039;&#039; Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STY:&#039;&#039;&#039; Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STZ:&#039;&#039;&#039; Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* &#039;&#039;&#039;LDX #$A0:&#039;&#039;&#039; Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY $7890:&#039;&#039;&#039; Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* &#039;&#039;&#039;LDA ($00):&#039;&#039;&#039; Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* &#039;&#039;&#039;STX $4567:&#039;&#039;&#039; Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* &#039;&#039;&#039;STA ($00):&#039;&#039;&#039; Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;br /&gt;
&lt;br /&gt;
= Registro de Status y  Operaciones Aritméticas y Lógicas =&lt;br /&gt;
== Registro de Status ==&lt;br /&gt;
El Registro de Status también llamado Registro P, es un registro especial de la SNES, este se encarga de guardar el estado actual de la ALU (Unidad Aritmética Lógica), de acá podemos extraer información que nos puede ayudar en combinación de ciertos comandos, también podemos utilizarlo para que los registro A, X e Y puedan cambiar entre modo de 8 bits y 16 bits.&lt;br /&gt;
El registro P tiene los siguientes bits o flags:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Status Flags&lt;br /&gt;
|-&lt;br /&gt;
! Flag !! Valor !! Descripción&lt;br /&gt;
|-&lt;br /&gt;
| N || #$80 || Si el flag es 1, la última operación dio un resultado con valor negativo. Los números negativos van desde -1 (0xFF) a -128 (0x80), si el valor es 0 entonces el último resultado fue positivo.&lt;br /&gt;
|-&lt;br /&gt;
| V || #$40 || Si el flag es 1, significa que la última operación de forma errónea paso de un número negativo a uno positivo o viceversa, se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|-&lt;br /&gt;
| M || #$20 || Si el flag es 1, significa que el registro A es de 8 bits, sino es de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| X || #$10 || Si el flag es 1, significa que el registro X e Y son de 8 bits, sino son de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| D || #$08 || Si el flag es 1, significa que las operaciones aritméticas se harán como si fuera una operación con números en base 10, sino usa base 16.&lt;br /&gt;
|-&lt;br /&gt;
| I || #$04 || Si el flag es 1, significa que el hardware está en una Interrupción, esto es algo avanzado y se explicará en otro capitulo a futuro.&lt;br /&gt;
|-&lt;br /&gt;
| Z || #$02 || Si el flag es 1, significa que el último resultado de una operación dio el valor cero.&lt;br /&gt;
|-&lt;br /&gt;
| C || #$01 || Si el flag es 1, significa que la última operación superó el límite que el registro podía abarcar, esto se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|}&lt;br /&gt;
Estos serían todos los flags que necesitaremos del registro P.&lt;br /&gt;
Existen 2 comandos especiales para escribir valores en el registro P.&lt;br /&gt;
* &#039;&#039;&#039;REP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 0, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
* &#039;&#039;&#039;SEP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 1, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
Ejemplos de uso:&lt;br /&gt;
* &#039;&#039;&#039;REP #$20:&#039;&#039;&#039; Pone en cero el flag M, por lo tanto haría que el registro A sea de 16 bits.&lt;br /&gt;
* &#039;&#039;&#039;SEP #$20:&#039;&#039;&#039; Pone en 1 el flag M, por lo tanto haría que el registro A sea de 8 bits.&lt;br /&gt;
&lt;br /&gt;
Con los comandos REP y SEP se puede alterar cualquiera de los flags, aunque también existen otros comandos alternativos que pueden hacer lo mismo para algunos flags específicos. Estos son:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;CLV:&#039;&#039;&#039; Pone el Flag V y lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEC y CLC:&#039;&#039;&#039; SEC pone el Flag C en 1 y CLC lo pone  en 0.&lt;br /&gt;
* &#039;&#039;&#039;SED y CLD:&#039;&#039;&#039; SED pone el Flag D en 1 y CLD lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEI y CLI:&#039;&#039;&#039; SEI pone el Flag I en 1 y CLI lo pone en 0.&lt;br /&gt;
&lt;br /&gt;
Estos comandos en general no tienen ninguna ventaja en términos de performance con REP y SEP, aunque pueden servir debido a que usan 1 byte en vez de 2, también es más fácil memorizarlos en general.&lt;br /&gt;
&lt;br /&gt;
=== ¿Qué sucede cuando un registro cambia de 16 a 8 bits? ===&lt;br /&gt;
En el caso del registro A, el High byte del registro queda en el mismo valor que cuando estaba en 16 bits y luego todas las operaciones que hagas serán usando el Low Byte del registro A. Ejemplo si A fuera FC08, al pasarlo a 8 bits, seguiría teniendo el valor FC08, y luego si hicieras algo como LDA #$02, solo cambiaría el Low byte, quedando FC02.&lt;br /&gt;
En el caso del registro X e Y, el High byte pasa a 00 cuando se pasa a 8 bits y luego cualquier operación que se haga afecta solo al Low Byte. Ejemplo, si X fuera FC08, al pasarlo a 8 bits sería 0008, luego si hicieras algo como LDX #$02, solo cambiaría el Low byte, quedando 0002.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Aritméticas ==&lt;br /&gt;
Las operaciones aritméticas nos permiten en la SNES hacer sumas y restas, el Super Nintendo no tiene un comando para hacer multiplicaciones o divisiones, sino que usa un sistema aparte para realizar estas operaciones y que se verán a mayor profundidad en otro capítulo.&lt;br /&gt;
Los comandos aritméticos son:&lt;br /&gt;
* &#039;&#039;&#039;ADC:&#039;&#039;&#039; Suma el valor del registro A con el parámetro del comando, si el flag C es 1, se le añade 1 a la suma.&lt;br /&gt;
* &#039;&#039;&#039;SBC:&#039;&#039;&#039; Resta el valor del registro A con el parámetro del comando, si el flag C es 0, se le resta 1 más a la resta.&lt;br /&gt;
* &#039;&#039;&#039;INC:&#039;&#039;&#039; Incrementa lo que está en el parámetro en 1, INC A incrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;INX, INY:&#039;&#039;&#039; Incrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
* &#039;&#039;&#039;DEC:&#039;&#039;&#039; Decrementa lo que está en el parámetro en 1, INC A Decrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;DEX, DEY:&#039;&#039;&#039; Decrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
&lt;br /&gt;
Todos estos comandos pueden afectar al flag N si es que el resultado es negativo o no y al flag Z si el resultado es cero o no.&lt;br /&gt;
El comando ADC y SBC pueden afectar al flag V y C, la forma en que afectan es:&lt;br /&gt;
* El flag V se activa cuando una operación (suma o resta) que debiera dar un valor negativo, da un valor positivo, o debiera dar un valor positivo, pero da un valor negativo. Por ejemplo:&lt;br /&gt;
** Si al sumar 2 números positivos da un valor negativo, por ejemplo si sumas 0x7F con 0x02, ambos son positivos, pero el resultado es 0x81 que es -127, en este caso se activa el flag V.&lt;br /&gt;
** Si al sumar 2 números negativos se pasa da un valor positivo, por ejemplo si sumas 0x80 con 0xFE, ambos son negativos, pero el resultado da 0x7E que es positivo, en este caso se activa el flag V.&lt;br /&gt;
* El flag C se activa cuando el resultado de una suma da un valor mayor al límite del registro o cuando al hacer una resta, el valor que se resta es mayor que el valor en el registro A. Por ejemplo:&lt;br /&gt;
** A de 8 bits, se suma 0xFE con 0x02, esto da 0x100, pero esto no cabe en 8 bits, así que A seria 0x00 y el flag C se activa.&lt;br /&gt;
** A de 8 bits, a 0x03 se le resta 0x06, esto da 0xFD y activará el flag C.&lt;br /&gt;
&lt;br /&gt;
Para la operación ADC lo recomendable sería antes del comando usar el comando CLC para que no añada 1 extra, en el caso de SBC, lo ideal sería antes del comando usar el comando SEC para que no reste 1 extra. Ejemplos&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA #$01&lt;br /&gt;
CLC&lt;br /&gt;
ADC #$02 ;1 + 2 = 3&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
SEC&lt;br /&gt;
SBC #$01 ;2 - 1 = 1&lt;br /&gt;
&lt;br /&gt;
LDA #$01&lt;br /&gt;
SEC&lt;br /&gt;
ADC #$02 ;1 + 2 + 1 = 4&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
CLC&lt;br /&gt;
SBC #$01 ;2 - 1 - 1 = 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En algunos casos especificos se puede evitar el SEC y SBC. Sobretodo cuando operas números de 16 bits pero con registros de 8 bits.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA !LowByte ;Para este ejemplo !LowByte es 0xFF&lt;br /&gt;
CLC&lt;br /&gt;
ADC #$01&lt;br /&gt;
STA !Result&lt;br /&gt;
&lt;br /&gt;
LDA !HighByte ;Para este ejemplo  !HighByte es 0x01&lt;br /&gt;
ADC #$00&lt;br /&gt;
STA !Result+1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En el ejemplo anterior, se le suma 1 a !LowByte y se guarda en !Result, sin embargo !LowByte es 0xFF así que el resultado debiera dar 0x100, pero A es de 8 bits y no puede almacenar ese número, sin embargo al hacer la suma el flag C se activa y luego podemos sumarle 0 al !HighByte para que de el resultado correcto, al final !Result como variable de 16 bits, tendrá el valor 0x200. Nótese que si la primera suma no hubiera activado el flag C, la segunda suma no haría nada, por lo tanto esto sirve para operar números que tienen un tamaño mayor que el tamaño del registro.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Lógicas ==&lt;br /&gt;
Existen comandos llamados Bitwise, todos estos funcionan aplicando operaciones lógicas bit a bit. Los comandos son los siguientes:&lt;br /&gt;
* &#039;&#039;&#039;AND:&#039;&#039;&#039; Aplica al registro A la operación AND bit a bit con el parámetro del comando.&lt;br /&gt;
* &#039;&#039;&#039;ORA:&#039;&#039;&#039; Aplica al registro A la operación OR bit a bit con el parámetro del comando.&lt;br /&gt;
* &#039;&#039;&#039;EOR:&#039;&#039;&#039; Aplica al registro A la operación Exclusive-OR bit a bit con el parámetro del comando.&lt;br /&gt;
&lt;br /&gt;
Todos los comandos lógicos pueden afectar al flag N y Z. Las tablas de verdad de estos comandos son:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tablas de Verdad comandos AND, ORA y EOR&lt;br /&gt;
|-&lt;br /&gt;
! V1 !! V2 !! V1 AND V2 !! V1 ORA V2 !! V1 EOR V2&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Veamos algunos ejemplos:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA #$13&lt;br /&gt;
AND #$15&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En este caso A tiene el valor 0x13 que en binario es 00010011b y luego se le aplica AND #$15 que en binario es 00010101b, aplicamos la operación AND bit a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00010001b -&amp;gt; V1 AND V2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ahora reemplazando el AND por un ORA:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00010111b -&amp;gt; V1 ORA V2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ahora reemplazando el ORA por un EOR:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00000110b -&amp;gt; V1 EOR V2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En la práctica estos comandos tienen múltiples usos, aunque los más comunes son:&lt;br /&gt;
* A&#039;&#039;&#039;ND:&#039;&#039;&#039;&lt;br /&gt;
** Poner en 0 uno o más bits del registro A.&lt;br /&gt;
** Saber si un bit específico está en 1 o no. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
* &#039;&#039;&#039;ORA:&#039;&#039;&#039;&lt;br /&gt;
** Poner en 1 uno o más bits del registro A.&lt;br /&gt;
** Saber si múltiples valores tienen un valor distinto de 0. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
* &#039;&#039;&#039;EOR:&#039;&#039;&#039;&lt;br /&gt;
** Cambiar el valor de uno o más bits del registro A.&lt;br /&gt;
** Saber si un bit específico es igual o distinto a un bit específico del parámetro del comando. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
&lt;br /&gt;
== Operaciones Shift y Rotate ==&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20759</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20759"/>
		<updated>2025-02-18T17:14:55Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Operaciones Lógicas */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|ASMTutorial}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* Binario: Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #%00001000 (seria el valor 8)&lt;br /&gt;
* Hexadecimal: Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #$10 (sería el valor 16)&lt;br /&gt;
* Decimal: Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* &#039;&#039;&#039;Bank:&#039;&#039;&#039; Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* &#039;&#039;&#039;High Byte:&#039;&#039;&#039; Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* &#039;&#039;&#039;Low Byte:&#039;&#039;&#039; este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* &#039;&#039;&#039;$7E-$7F:&#039;&#039;&#039; son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* &#039;&#039;&#039;$00-$3F:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$80-$CF:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$70-$71:&#039;&#039;&#039; SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* &#039;&#039;&#039;LDA:&#039;&#039;&#039; Guarda un valor en el registro A.&lt;br /&gt;
* &#039;&#039;&#039;LDX:&#039;&#039;&#039; Guarda un valor en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY:&#039;&#039;&#039; Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* &#039;&#039;&#039;STA:&#039;&#039;&#039; Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STX:&#039;&#039;&#039; Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STY:&#039;&#039;&#039; Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STZ:&#039;&#039;&#039; Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* &#039;&#039;&#039;LDX #$A0:&#039;&#039;&#039; Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY $7890:&#039;&#039;&#039; Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* &#039;&#039;&#039;LDA ($00):&#039;&#039;&#039; Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* &#039;&#039;&#039;STX $4567:&#039;&#039;&#039; Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* &#039;&#039;&#039;STA ($00):&#039;&#039;&#039; Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;br /&gt;
&lt;br /&gt;
= Registro de Status y  Operaciones Aritméticas y Lógicas =&lt;br /&gt;
== Registro de Status ==&lt;br /&gt;
El Registro de Status también llamado Registro P, es un registro especial de la SNES, este se encarga de guardar el estado actual de la ALU (Unidad Aritmética Lógica), de acá podemos extraer información que nos puede ayudar en combinación de ciertos comandos, también podemos utilizarlo para que los registro A, X e Y puedan cambiar entre modo de 8 bits y 16 bits.&lt;br /&gt;
El registro P tiene los siguientes bits o flags:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Status Flags&lt;br /&gt;
|-&lt;br /&gt;
! Flag !! Valor !! Descripción&lt;br /&gt;
|-&lt;br /&gt;
| N || #$80 || Si el flag es 1, la última operación dio un resultado con valor negativo. Los números negativos van desde -1 (0xFF) a -128 (0x80), si el valor es 0 entonces el último resultado fue positivo.&lt;br /&gt;
|-&lt;br /&gt;
| V || #$40 || Si el flag es 1, significa que la última operación de forma errónea paso de un número negativo a uno positivo o viceversa, se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|-&lt;br /&gt;
| M || #$20 || Si el flag es 1, significa que el registro A es de 8 bits, sino es de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| X || #$10 || Si el flag es 1, significa que el registro X e Y son de 8 bits, sino son de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| D || #$08 || Si el flag es 1, significa que las operaciones aritméticas se harán como si fuera una operación con números en base 10, sino usa base 16.&lt;br /&gt;
|-&lt;br /&gt;
| I || #$04 || Si el flag es 1, significa que el hardware está en una Interrupción, esto es algo avanzado y se explicará en otro capitulo a futuro.&lt;br /&gt;
|-&lt;br /&gt;
| Z || #$02 || Si el flag es 1, significa que el último resultado de una operación dio el valor cero.&lt;br /&gt;
|-&lt;br /&gt;
| C || #$01 || Si el flag es 1, significa que la última operación superó el límite que el registro podía abarcar, esto se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|}&lt;br /&gt;
Estos serían todos los flags que necesitaremos del registro P.&lt;br /&gt;
Existen 2 comandos especiales para escribir valores en el registro P.&lt;br /&gt;
* &#039;&#039;&#039;REP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 0, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
* &#039;&#039;&#039;SEP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 1, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
Ejemplos de uso:&lt;br /&gt;
* &#039;&#039;&#039;REP #$20:&#039;&#039;&#039; Pone en cero el flag M, por lo tanto haría que el registro A sea de 16 bits.&lt;br /&gt;
* &#039;&#039;&#039;SEP #$20:&#039;&#039;&#039; Pone en 1 el flag M, por lo tanto haría que el registro A sea de 8 bits.&lt;br /&gt;
&lt;br /&gt;
Con los comandos REP y SEP se puede alterar cualquiera de los flags, aunque también existen otros comandos alternativos que pueden hacer lo mismo para algunos flags específicos. Estos son:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;CLV:&#039;&#039;&#039; Pone el Flag V y lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEC y CLC:&#039;&#039;&#039; SEC pone el Flag C en 1 y CLC lo pone  en 0.&lt;br /&gt;
* &#039;&#039;&#039;SED y CLD:&#039;&#039;&#039; SED pone el Flag D en 1 y CLD lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEI y CLI:&#039;&#039;&#039; SEI pone el Flag I en 1 y CLI lo pone en 0.&lt;br /&gt;
&lt;br /&gt;
Estos comandos en general no tienen ninguna ventaja en términos de performance con REP y SEP, aunque pueden servir debido a que usan 1 byte en vez de 2, también es más fácil memorizarlos en general.&lt;br /&gt;
&lt;br /&gt;
=== ¿Qué sucede cuando un registro cambia de 16 a 8 bits? ===&lt;br /&gt;
En el caso del registro A, el High byte del registro queda en el mismo valor que cuando estaba en 16 bits y luego todas las operaciones que hagas serán usando el Low Byte del registro A. Ejemplo si A fuera FC08, al pasarlo a 8 bits, seguiría teniendo el valor FC08, y luego si hicieras algo como LDA #$02, solo cambiaría el Low byte, quedando FC02.&lt;br /&gt;
En el caso del registro X e Y, el High byte pasa a 00 cuando se pasa a 8 bits y luego cualquier operación que se haga afecta solo al Low Byte. Ejemplo, si X fuera FC08, al pasarlo a 8 bits sería 0008, luego si hicieras algo como LDX #$02, solo cambiaría el Low byte, quedando 0002.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Aritméticas ==&lt;br /&gt;
Las operaciones aritméticas nos permiten en la SNES hacer sumas y restas, el Super Nintendo no tiene un comando para hacer multiplicaciones o divisiones, sino que usa un sistema aparte para realizar estas operaciones y que se verán a mayor profundidad en otro capítulo.&lt;br /&gt;
Los comandos aritméticos son:&lt;br /&gt;
* &#039;&#039;&#039;ADC:&#039;&#039;&#039; Suma el valor del registro A con el parámetro del comando, si el flag C es 1, se le añade 1 a la suma.&lt;br /&gt;
* &#039;&#039;&#039;SBC:&#039;&#039;&#039; Resta el valor del registro A con el parámetro del comando, si el flag C es 0, se le resta 1 más a la resta.&lt;br /&gt;
* &#039;&#039;&#039;INC:&#039;&#039;&#039; Incrementa lo que está en el parámetro en 1, INC A incrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;INX, INY:&#039;&#039;&#039; Incrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
* &#039;&#039;&#039;DEC:&#039;&#039;&#039; Decrementa lo que está en el parámetro en 1, INC A Decrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;DEX, DEY:&#039;&#039;&#039; Decrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
&lt;br /&gt;
Todos estos comandos pueden afectar al flag N si es que el resultado es negativo o no y al flag Z si el resultado es cero o no.&lt;br /&gt;
El comando ADC y SBC pueden afectar al flag V y C, la forma en que afectan es:&lt;br /&gt;
* El flag V se activa cuando una operación (suma o resta) que debiera dar un valor negativo, da un valor positivo, o debiera dar un valor positivo, pero da un valor negativo. Por ejemplo:&lt;br /&gt;
** Si al sumar 2 números positivos da un valor negativo, por ejemplo si sumas 0x7F con 0x02, ambos son positivos, pero el resultado es 0x81 que es -127, en este caso se activa el flag V.&lt;br /&gt;
** Si al sumar 2 números negativos se pasa da un valor positivo, por ejemplo si sumas 0x80 con 0xFE, ambos son negativos, pero el resultado da 0x7E que es positivo, en este caso se activa el flag V.&lt;br /&gt;
* El flag C se activa cuando el resultado de una suma da un valor mayor al límite del registro o cuando al hacer una resta, el valor que se resta es mayor que el valor en el registro A. Por ejemplo:&lt;br /&gt;
** A de 8 bits, se suma 0xFE con 0x02, esto da 0x100, pero esto no cabe en 8 bits, así que A seria 0x00 y el flag C se activa.&lt;br /&gt;
** A de 8 bits, a 0x03 se le resta 0x06, esto da 0xFD y activará el flag C.&lt;br /&gt;
&lt;br /&gt;
Para la operación ADC lo recomendable sería antes del comando usar el comando CLC para que no añada 1 extra, en el caso de SBC, lo ideal sería antes del comando usar el comando SEC para que no reste 1 extra. Ejemplos&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA #$01&lt;br /&gt;
CLC&lt;br /&gt;
ADC #$02 ;1 + 2 = 3&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
SEC&lt;br /&gt;
SBC #$01 ;2 - 1 = 1&lt;br /&gt;
&lt;br /&gt;
LDA #$01&lt;br /&gt;
SEC&lt;br /&gt;
ADC #$02 ;1 + 2 + 1 = 4&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
CLC&lt;br /&gt;
SBC #$01 ;2 - 1 - 1 = 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En algunos casos especificos se puede evitar el SEC y SBC. Sobretodo cuando operas números de 16 bits pero con registros de 8 bits.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA !LowByte ;Para este ejemplo !LowByte es 0xFF&lt;br /&gt;
CLC&lt;br /&gt;
ADC #$01&lt;br /&gt;
STA !Result&lt;br /&gt;
&lt;br /&gt;
LDA !HighByte ;Para este ejemplo  !HighByte es 0x01&lt;br /&gt;
ADC #$00&lt;br /&gt;
STA !Result+1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En el ejemplo anterior, se le suma 1 a !LowByte y se guarda en !Result, sin embargo !LowByte es 0xFF así que el resultado debiera dar 0x100, pero A es de 8 bits y no puede almacenar ese número, sin embargo al hacer la suma el flag C se activa y luego podemos sumarle 0 al !HighByte para que de el resultado correcto, al final !Result como variable de 16 bits, tendrá el valor 0x200. Nótese que si la primera suma no hubiera activado el flag C, la segunda suma no haría nada, por lo tanto esto sirve para operar números que tienen un tamaño mayor que el tamaño del registro.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Lógicas ==&lt;br /&gt;
Existen comandos llamados Bitwise, todos estos funcionan aplicando operaciones lógicas bit a bit. Los comandos son los siguientes:&lt;br /&gt;
* &#039;&#039;&#039;AND:&#039;&#039;&#039; Aplica al registro A la operación AND bit a bit con el parámetro del comando.&lt;br /&gt;
* &#039;&#039;&#039;ORA:&#039;&#039;&#039; Aplica al registro A la operación OR bit a bit con el parámetro del comando.&lt;br /&gt;
* &#039;&#039;&#039;EOR:&#039;&#039;&#039; Aplica al registro A la operación Exclusive-OR bit a bit con el parámetro del comando.&lt;br /&gt;
&lt;br /&gt;
Todos los comandos lógicos pueden afectar al flag N y Z. Las tablas de verdad de estos comandos son:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tablas de Verdad comandos AND, ORA y EOR&lt;br /&gt;
|-&lt;br /&gt;
! V1 !! V2 !! V1 AND V2 !! V1 ORA V2 !! V1 EOR V2&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Veamos algunos ejemplos:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA #$13&lt;br /&gt;
AND #$15&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En este caso A tiene el valor 0x13 que en binario es 00010011b y luego se le aplica AND #$15 que en binario es 00010101b, aplicamos la operación AND bit a bit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00010001b -&amp;gt; V1 AND V2&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ahora reemplazando el AND por un ORA:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00010111b -&amp;gt; V1 ORA V2&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ahora reemplazando el ORA por un EOR:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
00010011b -&amp;gt; V1&lt;br /&gt;
00010101b -&amp;gt; V2&lt;br /&gt;
00000110b -&amp;gt; V1 EOR V2&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En la práctica estos comandos tienen múltiples usos, aunque los más comunes son:&lt;br /&gt;
* A&#039;&#039;&#039;ND:&#039;&#039;&#039;&lt;br /&gt;
** Poner en 0 uno o más bits del registro A.&lt;br /&gt;
** Saber si un bit específico está en 1 o no. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
* &#039;&#039;&#039;ORA:&#039;&#039;&#039;&lt;br /&gt;
** Poner en 1 uno o más bits del registro A.&lt;br /&gt;
** Saber si múltiples valores tienen un valor distinto de 0. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
* &#039;&#039;&#039;EOR:&#039;&#039;&#039;&lt;br /&gt;
** Cambiar el valor de uno o más bits del registro A.&lt;br /&gt;
** Saber si un bit específico es igual o distinto a un bit específico del parámetro del comando. (Se verá a mayor profundidad en el capítulo sobre saltos condicionales)&lt;br /&gt;
&lt;br /&gt;
== Operaciones Shift y Rotate ==&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20758</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20758"/>
		<updated>2025-02-18T17:11:06Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Operaciones Lógicas */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|ASMTutorial}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* Binario: Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #%00001000 (seria el valor 8)&lt;br /&gt;
* Hexadecimal: Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #$10 (sería el valor 16)&lt;br /&gt;
* Decimal: Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* &#039;&#039;&#039;Bank:&#039;&#039;&#039; Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* &#039;&#039;&#039;High Byte:&#039;&#039;&#039; Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* &#039;&#039;&#039;Low Byte:&#039;&#039;&#039; este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* &#039;&#039;&#039;$7E-$7F:&#039;&#039;&#039; son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* &#039;&#039;&#039;$00-$3F:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$80-$CF:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$70-$71:&#039;&#039;&#039; SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* &#039;&#039;&#039;LDA:&#039;&#039;&#039; Guarda un valor en el registro A.&lt;br /&gt;
* &#039;&#039;&#039;LDX:&#039;&#039;&#039; Guarda un valor en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY:&#039;&#039;&#039; Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* &#039;&#039;&#039;STA:&#039;&#039;&#039; Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STX:&#039;&#039;&#039; Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STY:&#039;&#039;&#039; Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STZ:&#039;&#039;&#039; Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* &#039;&#039;&#039;LDX #$A0:&#039;&#039;&#039; Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY $7890:&#039;&#039;&#039; Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* &#039;&#039;&#039;LDA ($00):&#039;&#039;&#039; Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* &#039;&#039;&#039;STX $4567:&#039;&#039;&#039; Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* &#039;&#039;&#039;STA ($00):&#039;&#039;&#039; Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;br /&gt;
&lt;br /&gt;
= Registro de Status y  Operaciones Aritméticas y Lógicas =&lt;br /&gt;
== Registro de Status ==&lt;br /&gt;
El Registro de Status también llamado Registro P, es un registro especial de la SNES, este se encarga de guardar el estado actual de la ALU (Unidad Aritmética Lógica), de acá podemos extraer información que nos puede ayudar en combinación de ciertos comandos, también podemos utilizarlo para que los registro A, X e Y puedan cambiar entre modo de 8 bits y 16 bits.&lt;br /&gt;
El registro P tiene los siguientes bits o flags:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Status Flags&lt;br /&gt;
|-&lt;br /&gt;
! Flag !! Valor !! Descripción&lt;br /&gt;
|-&lt;br /&gt;
| N || #$80 || Si el flag es 1, la última operación dio un resultado con valor negativo. Los números negativos van desde -1 (0xFF) a -128 (0x80), si el valor es 0 entonces el último resultado fue positivo.&lt;br /&gt;
|-&lt;br /&gt;
| V || #$40 || Si el flag es 1, significa que la última operación de forma errónea paso de un número negativo a uno positivo o viceversa, se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|-&lt;br /&gt;
| M || #$20 || Si el flag es 1, significa que el registro A es de 8 bits, sino es de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| X || #$10 || Si el flag es 1, significa que el registro X e Y son de 8 bits, sino son de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| D || #$08 || Si el flag es 1, significa que las operaciones aritméticas se harán como si fuera una operación con números en base 10, sino usa base 16.&lt;br /&gt;
|-&lt;br /&gt;
| I || #$04 || Si el flag es 1, significa que el hardware está en una Interrupción, esto es algo avanzado y se explicará en otro capitulo a futuro.&lt;br /&gt;
|-&lt;br /&gt;
| Z || #$02 || Si el flag es 1, significa que el último resultado de una operación dio el valor cero.&lt;br /&gt;
|-&lt;br /&gt;
| C || #$01 || Si el flag es 1, significa que la última operación superó el límite que el registro podía abarcar, esto se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|}&lt;br /&gt;
Estos serían todos los flags que necesitaremos del registro P.&lt;br /&gt;
Existen 2 comandos especiales para escribir valores en el registro P.&lt;br /&gt;
* &#039;&#039;&#039;REP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 0, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
* &#039;&#039;&#039;SEP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 1, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
Ejemplos de uso:&lt;br /&gt;
* &#039;&#039;&#039;REP #$20:&#039;&#039;&#039; Pone en cero el flag M, por lo tanto haría que el registro A sea de 16 bits.&lt;br /&gt;
* &#039;&#039;&#039;SEP #$20:&#039;&#039;&#039; Pone en 1 el flag M, por lo tanto haría que el registro A sea de 8 bits.&lt;br /&gt;
&lt;br /&gt;
Con los comandos REP y SEP se puede alterar cualquiera de los flags, aunque también existen otros comandos alternativos que pueden hacer lo mismo para algunos flags específicos. Estos son:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;CLV:&#039;&#039;&#039; Pone el Flag V y lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEC y CLC:&#039;&#039;&#039; SEC pone el Flag C en 1 y CLC lo pone  en 0.&lt;br /&gt;
* &#039;&#039;&#039;SED y CLD:&#039;&#039;&#039; SED pone el Flag D en 1 y CLD lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEI y CLI:&#039;&#039;&#039; SEI pone el Flag I en 1 y CLI lo pone en 0.&lt;br /&gt;
&lt;br /&gt;
Estos comandos en general no tienen ninguna ventaja en términos de performance con REP y SEP, aunque pueden servir debido a que usan 1 byte en vez de 2, también es más fácil memorizarlos en general.&lt;br /&gt;
&lt;br /&gt;
=== ¿Qué sucede cuando un registro cambia de 16 a 8 bits? ===&lt;br /&gt;
En el caso del registro A, el High byte del registro queda en el mismo valor que cuando estaba en 16 bits y luego todas las operaciones que hagas serán usando el Low Byte del registro A. Ejemplo si A fuera FC08, al pasarlo a 8 bits, seguiría teniendo el valor FC08, y luego si hicieras algo como LDA #$02, solo cambiaría el Low byte, quedando FC02.&lt;br /&gt;
En el caso del registro X e Y, el High byte pasa a 00 cuando se pasa a 8 bits y luego cualquier operación que se haga afecta solo al Low Byte. Ejemplo, si X fuera FC08, al pasarlo a 8 bits sería 0008, luego si hicieras algo como LDX #$02, solo cambiaría el Low byte, quedando 0002.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Aritméticas ==&lt;br /&gt;
Las operaciones aritméticas nos permiten en la SNES hacer sumas y restas, el Super Nintendo no tiene un comando para hacer multiplicaciones o divisiones, sino que usa un sistema aparte para realizar estas operaciones y que se verán a mayor profundidad en otro capítulo.&lt;br /&gt;
Los comandos aritméticos son:&lt;br /&gt;
* &#039;&#039;&#039;ADC:&#039;&#039;&#039; Suma el valor del registro A con el parámetro del comando, si el flag C es 1, se le añade 1 a la suma.&lt;br /&gt;
* &#039;&#039;&#039;SBC:&#039;&#039;&#039; Resta el valor del registro A con el parámetro del comando, si el flag C es 0, se le resta 1 más a la resta.&lt;br /&gt;
* &#039;&#039;&#039;INC:&#039;&#039;&#039; Incrementa lo que está en el parámetro en 1, INC A incrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;INX, INY:&#039;&#039;&#039; Incrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
* &#039;&#039;&#039;DEC:&#039;&#039;&#039; Decrementa lo que está en el parámetro en 1, INC A Decrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;DEX, DEY:&#039;&#039;&#039; Decrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
&lt;br /&gt;
Todos estos comandos pueden afectar al flag N si es que el resultado es negativo o no y al flag Z si el resultado es cero o no.&lt;br /&gt;
El comando ADC y SBC pueden afectar al flag V y C, la forma en que afectan es:&lt;br /&gt;
* El flag V se activa cuando una operación (suma o resta) que debiera dar un valor negativo, da un valor positivo, o debiera dar un valor positivo, pero da un valor negativo. Por ejemplo:&lt;br /&gt;
** Si al sumar 2 números positivos da un valor negativo, por ejemplo si sumas 0x7F con 0x02, ambos son positivos, pero el resultado es 0x81 que es -127, en este caso se activa el flag V.&lt;br /&gt;
** Si al sumar 2 números negativos se pasa da un valor positivo, por ejemplo si sumas 0x80 con 0xFE, ambos son negativos, pero el resultado da 0x7E que es positivo, en este caso se activa el flag V.&lt;br /&gt;
* El flag C se activa cuando el resultado de una suma da un valor mayor al límite del registro o cuando al hacer una resta, el valor que se resta es mayor que el valor en el registro A. Por ejemplo:&lt;br /&gt;
** A de 8 bits, se suma 0xFE con 0x02, esto da 0x100, pero esto no cabe en 8 bits, así que A seria 0x00 y el flag C se activa.&lt;br /&gt;
** A de 8 bits, a 0x03 se le resta 0x06, esto da 0xFD y activará el flag C.&lt;br /&gt;
&lt;br /&gt;
Para la operación ADC lo recomendable sería antes del comando usar el comando CLC para que no añada 1 extra, en el caso de SBC, lo ideal sería antes del comando usar el comando SEC para que no reste 1 extra. Ejemplos&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA #$01&lt;br /&gt;
CLC&lt;br /&gt;
ADC #$02 ;1 + 2 = 3&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
SEC&lt;br /&gt;
SBC #$01 ;2 - 1 = 1&lt;br /&gt;
&lt;br /&gt;
LDA #$01&lt;br /&gt;
SEC&lt;br /&gt;
ADC #$02 ;1 + 2 + 1 = 4&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
CLC&lt;br /&gt;
SBC #$01 ;2 - 1 - 1 = 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En algunos casos especificos se puede evitar el SEC y SBC. Sobretodo cuando operas números de 16 bits pero con registros de 8 bits.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA !LowByte ;Para este ejemplo !LowByte es 0xFF&lt;br /&gt;
CLC&lt;br /&gt;
ADC #$01&lt;br /&gt;
STA !Result&lt;br /&gt;
&lt;br /&gt;
LDA !HighByte ;Para este ejemplo  !HighByte es 0x01&lt;br /&gt;
ADC #$00&lt;br /&gt;
STA !Result+1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En el ejemplo anterior, se le suma 1 a !LowByte y se guarda en !Result, sin embargo !LowByte es 0xFF así que el resultado debiera dar 0x100, pero A es de 8 bits y no puede almacenar ese número, sin embargo al hacer la suma el flag C se activa y luego podemos sumarle 0 al !HighByte para que de el resultado correcto, al final !Result como variable de 16 bits, tendrá el valor 0x200. Nótese que si la primera suma no hubiera activado el flag C, la segunda suma no haría nada, por lo tanto esto sirve para operar números que tienen un tamaño mayor que el tamaño del registro.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Lógicas ==&lt;br /&gt;
Existen comandos llamados Bitwise, todos estos funcionan aplicando operaciones lógicas bit a bit. Los comandos son los siguientes:&lt;br /&gt;
* &#039;&#039;&#039;AND:&#039;&#039;&#039; Aplica al registro A la operación AND bit a bit con el parámetro del comando.&lt;br /&gt;
* &#039;&#039;&#039;ORA:&#039;&#039;&#039; Aplica al registro A la operación OR bit a bit con el parámetro del comando.&lt;br /&gt;
* &#039;&#039;&#039;EOR:&#039;&#039;&#039; Aplica al registro A la operación Exclusive-OR bit a bit con el parámetro del comando.&lt;br /&gt;
&lt;br /&gt;
Todos los comandos lógicos pueden afectar al flag N y Z. Las tablas de verdad de estos comandos son:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Tablas de Verdad comandos AND, ORA y EOR&lt;br /&gt;
|-&lt;br /&gt;
! V1 !! V2 !! V1 AND V2 !! V1 ORA V2 !! V1 EOR V2&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 1 || 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 1 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Operaciones Shift y Rotate ==&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20757</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20757"/>
		<updated>2025-02-18T17:08:13Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Operaciones Aritméticas */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|ASMTutorial}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* Binario: Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #%00001000 (seria el valor 8)&lt;br /&gt;
* Hexadecimal: Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #$10 (sería el valor 16)&lt;br /&gt;
* Decimal: Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* &#039;&#039;&#039;Bank:&#039;&#039;&#039; Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* &#039;&#039;&#039;High Byte:&#039;&#039;&#039; Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* &#039;&#039;&#039;Low Byte:&#039;&#039;&#039; este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* &#039;&#039;&#039;$7E-$7F:&#039;&#039;&#039; son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* &#039;&#039;&#039;$00-$3F:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$80-$CF:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$70-$71:&#039;&#039;&#039; SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* &#039;&#039;&#039;LDA:&#039;&#039;&#039; Guarda un valor en el registro A.&lt;br /&gt;
* &#039;&#039;&#039;LDX:&#039;&#039;&#039; Guarda un valor en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY:&#039;&#039;&#039; Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* &#039;&#039;&#039;STA:&#039;&#039;&#039; Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STX:&#039;&#039;&#039; Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STY:&#039;&#039;&#039; Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STZ:&#039;&#039;&#039; Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* &#039;&#039;&#039;LDX #$A0:&#039;&#039;&#039; Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY $7890:&#039;&#039;&#039; Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* &#039;&#039;&#039;LDA ($00):&#039;&#039;&#039; Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* &#039;&#039;&#039;STX $4567:&#039;&#039;&#039; Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* &#039;&#039;&#039;STA ($00):&#039;&#039;&#039; Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;br /&gt;
&lt;br /&gt;
= Registro de Status y  Operaciones Aritméticas y Lógicas =&lt;br /&gt;
== Registro de Status ==&lt;br /&gt;
El Registro de Status también llamado Registro P, es un registro especial de la SNES, este se encarga de guardar el estado actual de la ALU (Unidad Aritmética Lógica), de acá podemos extraer información que nos puede ayudar en combinación de ciertos comandos, también podemos utilizarlo para que los registro A, X e Y puedan cambiar entre modo de 8 bits y 16 bits.&lt;br /&gt;
El registro P tiene los siguientes bits o flags:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Status Flags&lt;br /&gt;
|-&lt;br /&gt;
! Flag !! Valor !! Descripción&lt;br /&gt;
|-&lt;br /&gt;
| N || #$80 || Si el flag es 1, la última operación dio un resultado con valor negativo. Los números negativos van desde -1 (0xFF) a -128 (0x80), si el valor es 0 entonces el último resultado fue positivo.&lt;br /&gt;
|-&lt;br /&gt;
| V || #$40 || Si el flag es 1, significa que la última operación de forma errónea paso de un número negativo a uno positivo o viceversa, se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|-&lt;br /&gt;
| M || #$20 || Si el flag es 1, significa que el registro A es de 8 bits, sino es de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| X || #$10 || Si el flag es 1, significa que el registro X e Y son de 8 bits, sino son de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| D || #$08 || Si el flag es 1, significa que las operaciones aritméticas se harán como si fuera una operación con números en base 10, sino usa base 16.&lt;br /&gt;
|-&lt;br /&gt;
| I || #$04 || Si el flag es 1, significa que el hardware está en una Interrupción, esto es algo avanzado y se explicará en otro capitulo a futuro.&lt;br /&gt;
|-&lt;br /&gt;
| Z || #$02 || Si el flag es 1, significa que el último resultado de una operación dio el valor cero.&lt;br /&gt;
|-&lt;br /&gt;
| C || #$01 || Si el flag es 1, significa que la última operación superó el límite que el registro podía abarcar, esto se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|}&lt;br /&gt;
Estos serían todos los flags que necesitaremos del registro P.&lt;br /&gt;
Existen 2 comandos especiales para escribir valores en el registro P.&lt;br /&gt;
* &#039;&#039;&#039;REP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 0, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
* &#039;&#039;&#039;SEP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 1, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
Ejemplos de uso:&lt;br /&gt;
* &#039;&#039;&#039;REP #$20:&#039;&#039;&#039; Pone en cero el flag M, por lo tanto haría que el registro A sea de 16 bits.&lt;br /&gt;
* &#039;&#039;&#039;SEP #$20:&#039;&#039;&#039; Pone en 1 el flag M, por lo tanto haría que el registro A sea de 8 bits.&lt;br /&gt;
&lt;br /&gt;
Con los comandos REP y SEP se puede alterar cualquiera de los flags, aunque también existen otros comandos alternativos que pueden hacer lo mismo para algunos flags específicos. Estos son:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;CLV:&#039;&#039;&#039; Pone el Flag V y lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEC y CLC:&#039;&#039;&#039; SEC pone el Flag C en 1 y CLC lo pone  en 0.&lt;br /&gt;
* &#039;&#039;&#039;SED y CLD:&#039;&#039;&#039; SED pone el Flag D en 1 y CLD lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEI y CLI:&#039;&#039;&#039; SEI pone el Flag I en 1 y CLI lo pone en 0.&lt;br /&gt;
&lt;br /&gt;
Estos comandos en general no tienen ninguna ventaja en términos de performance con REP y SEP, aunque pueden servir debido a que usan 1 byte en vez de 2, también es más fácil memorizarlos en general.&lt;br /&gt;
&lt;br /&gt;
=== ¿Qué sucede cuando un registro cambia de 16 a 8 bits? ===&lt;br /&gt;
En el caso del registro A, el High byte del registro queda en el mismo valor que cuando estaba en 16 bits y luego todas las operaciones que hagas serán usando el Low Byte del registro A. Ejemplo si A fuera FC08, al pasarlo a 8 bits, seguiría teniendo el valor FC08, y luego si hicieras algo como LDA #$02, solo cambiaría el Low byte, quedando FC02.&lt;br /&gt;
En el caso del registro X e Y, el High byte pasa a 00 cuando se pasa a 8 bits y luego cualquier operación que se haga afecta solo al Low Byte. Ejemplo, si X fuera FC08, al pasarlo a 8 bits sería 0008, luego si hicieras algo como LDX #$02, solo cambiaría el Low byte, quedando 0002.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Aritméticas ==&lt;br /&gt;
Las operaciones aritméticas nos permiten en la SNES hacer sumas y restas, el Super Nintendo no tiene un comando para hacer multiplicaciones o divisiones, sino que usa un sistema aparte para realizar estas operaciones y que se verán a mayor profundidad en otro capítulo.&lt;br /&gt;
Los comandos aritméticos son:&lt;br /&gt;
* &#039;&#039;&#039;ADC:&#039;&#039;&#039; Suma el valor del registro A con el parámetro del comando, si el flag C es 1, se le añade 1 a la suma.&lt;br /&gt;
* &#039;&#039;&#039;SBC:&#039;&#039;&#039; Resta el valor del registro A con el parámetro del comando, si el flag C es 0, se le resta 1 más a la resta.&lt;br /&gt;
* &#039;&#039;&#039;INC:&#039;&#039;&#039; Incrementa lo que está en el parámetro en 1, INC A incrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;INX, INY:&#039;&#039;&#039; Incrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
* &#039;&#039;&#039;DEC:&#039;&#039;&#039; Decrementa lo que está en el parámetro en 1, INC A Decrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;DEX, DEY:&#039;&#039;&#039; Decrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
&lt;br /&gt;
Todos estos comandos pueden afectar al flag N si es que el resultado es negativo o no y al flag Z si el resultado es cero o no.&lt;br /&gt;
El comando ADC y SBC pueden afectar al flag V y C, la forma en que afectan es:&lt;br /&gt;
* El flag V se activa cuando una operación (suma o resta) que debiera dar un valor negativo, da un valor positivo, o debiera dar un valor positivo, pero da un valor negativo. Por ejemplo:&lt;br /&gt;
** Si al sumar 2 números positivos da un valor negativo, por ejemplo si sumas 0x7F con 0x02, ambos son positivos, pero el resultado es 0x81 que es -127, en este caso se activa el flag V.&lt;br /&gt;
** Si al sumar 2 números negativos se pasa da un valor positivo, por ejemplo si sumas 0x80 con 0xFE, ambos son negativos, pero el resultado da 0x7E que es positivo, en este caso se activa el flag V.&lt;br /&gt;
* El flag C se activa cuando el resultado de una suma da un valor mayor al límite del registro o cuando al hacer una resta, el valor que se resta es mayor que el valor en el registro A. Por ejemplo:&lt;br /&gt;
** A de 8 bits, se suma 0xFE con 0x02, esto da 0x100, pero esto no cabe en 8 bits, así que A seria 0x00 y el flag C se activa.&lt;br /&gt;
** A de 8 bits, a 0x03 se le resta 0x06, esto da 0xFD y activará el flag C.&lt;br /&gt;
&lt;br /&gt;
Para la operación ADC lo recomendable sería antes del comando usar el comando CLC para que no añada 1 extra, en el caso de SBC, lo ideal sería antes del comando usar el comando SEC para que no reste 1 extra. Ejemplos&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA #$01&lt;br /&gt;
CLC&lt;br /&gt;
ADC #$02 ;1 + 2 = 3&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
SEC&lt;br /&gt;
SBC #$01 ;2 - 1 = 1&lt;br /&gt;
&lt;br /&gt;
LDA #$01&lt;br /&gt;
SEC&lt;br /&gt;
ADC #$02 ;1 + 2 + 1 = 4&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
CLC&lt;br /&gt;
SBC #$01 ;2 - 1 - 1 = 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En algunos casos especificos se puede evitar el SEC y SBC. Sobretodo cuando operas números de 16 bits pero con registros de 8 bits.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA !LowByte ;Para este ejemplo !LowByte es 0xFF&lt;br /&gt;
CLC&lt;br /&gt;
ADC #$01&lt;br /&gt;
STA !Result&lt;br /&gt;
&lt;br /&gt;
LDA !HighByte ;Para este ejemplo  !HighByte es 0x01&lt;br /&gt;
ADC #$00&lt;br /&gt;
STA !Result+1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
En el ejemplo anterior, se le suma 1 a !LowByte y se guarda en !Result, sin embargo !LowByte es 0xFF así que el resultado debiera dar 0x100, pero A es de 8 bits y no puede almacenar ese número, sin embargo al hacer la suma el flag C se activa y luego podemos sumarle 0 al !HighByte para que de el resultado correcto, al final !Result como variable de 16 bits, tendrá el valor 0x200. Nótese que si la primera suma no hubiera activado el flag C, la segunda suma no haría nada, por lo tanto esto sirve para operar números que tienen un tamaño mayor que el tamaño del registro.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Lógicas ==&lt;br /&gt;
&lt;br /&gt;
== Operaciones Shift y Rotate ==&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20756</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20756"/>
		<updated>2025-02-18T17:07:05Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Operaciones Aritméticas */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|ASMTutorial}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* Binario: Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #%00001000 (seria el valor 8)&lt;br /&gt;
* Hexadecimal: Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #$10 (sería el valor 16)&lt;br /&gt;
* Decimal: Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* &#039;&#039;&#039;Bank:&#039;&#039;&#039; Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* &#039;&#039;&#039;High Byte:&#039;&#039;&#039; Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* &#039;&#039;&#039;Low Byte:&#039;&#039;&#039; este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* &#039;&#039;&#039;$7E-$7F:&#039;&#039;&#039; son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* &#039;&#039;&#039;$00-$3F:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$80-$CF:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$70-$71:&#039;&#039;&#039; SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* &#039;&#039;&#039;LDA:&#039;&#039;&#039; Guarda un valor en el registro A.&lt;br /&gt;
* &#039;&#039;&#039;LDX:&#039;&#039;&#039; Guarda un valor en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY:&#039;&#039;&#039; Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* &#039;&#039;&#039;STA:&#039;&#039;&#039; Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STX:&#039;&#039;&#039; Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STY:&#039;&#039;&#039; Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STZ:&#039;&#039;&#039; Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* &#039;&#039;&#039;LDX #$A0:&#039;&#039;&#039; Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY $7890:&#039;&#039;&#039; Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* &#039;&#039;&#039;LDA ($00):&#039;&#039;&#039; Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* &#039;&#039;&#039;STX $4567:&#039;&#039;&#039; Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* &#039;&#039;&#039;STA ($00):&#039;&#039;&#039; Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;br /&gt;
&lt;br /&gt;
= Registro de Status y  Operaciones Aritméticas y Lógicas =&lt;br /&gt;
== Registro de Status ==&lt;br /&gt;
El Registro de Status también llamado Registro P, es un registro especial de la SNES, este se encarga de guardar el estado actual de la ALU (Unidad Aritmética Lógica), de acá podemos extraer información que nos puede ayudar en combinación de ciertos comandos, también podemos utilizarlo para que los registro A, X e Y puedan cambiar entre modo de 8 bits y 16 bits.&lt;br /&gt;
El registro P tiene los siguientes bits o flags:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Status Flags&lt;br /&gt;
|-&lt;br /&gt;
! Flag !! Valor !! Descripción&lt;br /&gt;
|-&lt;br /&gt;
| N || #$80 || Si el flag es 1, la última operación dio un resultado con valor negativo. Los números negativos van desde -1 (0xFF) a -128 (0x80), si el valor es 0 entonces el último resultado fue positivo.&lt;br /&gt;
|-&lt;br /&gt;
| V || #$40 || Si el flag es 1, significa que la última operación de forma errónea paso de un número negativo a uno positivo o viceversa, se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|-&lt;br /&gt;
| M || #$20 || Si el flag es 1, significa que el registro A es de 8 bits, sino es de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| X || #$10 || Si el flag es 1, significa que el registro X e Y son de 8 bits, sino son de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| D || #$08 || Si el flag es 1, significa que las operaciones aritméticas se harán como si fuera una operación con números en base 10, sino usa base 16.&lt;br /&gt;
|-&lt;br /&gt;
| I || #$04 || Si el flag es 1, significa que el hardware está en una Interrupción, esto es algo avanzado y se explicará en otro capitulo a futuro.&lt;br /&gt;
|-&lt;br /&gt;
| Z || #$02 || Si el flag es 1, significa que el último resultado de una operación dio el valor cero.&lt;br /&gt;
|-&lt;br /&gt;
| C || #$01 || Si el flag es 1, significa que la última operación superó el límite que el registro podía abarcar, esto se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|}&lt;br /&gt;
Estos serían todos los flags que necesitaremos del registro P.&lt;br /&gt;
Existen 2 comandos especiales para escribir valores en el registro P.&lt;br /&gt;
* &#039;&#039;&#039;REP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 0, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
* &#039;&#039;&#039;SEP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 1, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
Ejemplos de uso:&lt;br /&gt;
* &#039;&#039;&#039;REP #$20:&#039;&#039;&#039; Pone en cero el flag M, por lo tanto haría que el registro A sea de 16 bits.&lt;br /&gt;
* &#039;&#039;&#039;SEP #$20:&#039;&#039;&#039; Pone en 1 el flag M, por lo tanto haría que el registro A sea de 8 bits.&lt;br /&gt;
&lt;br /&gt;
Con los comandos REP y SEP se puede alterar cualquiera de los flags, aunque también existen otros comandos alternativos que pueden hacer lo mismo para algunos flags específicos. Estos son:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;CLV:&#039;&#039;&#039; Pone el Flag V y lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEC y CLC:&#039;&#039;&#039; SEC pone el Flag C en 1 y CLC lo pone  en 0.&lt;br /&gt;
* &#039;&#039;&#039;SED y CLD:&#039;&#039;&#039; SED pone el Flag D en 1 y CLD lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEI y CLI:&#039;&#039;&#039; SEI pone el Flag I en 1 y CLI lo pone en 0.&lt;br /&gt;
&lt;br /&gt;
Estos comandos en general no tienen ninguna ventaja en términos de performance con REP y SEP, aunque pueden servir debido a que usan 1 byte en vez de 2, también es más fácil memorizarlos en general.&lt;br /&gt;
&lt;br /&gt;
=== ¿Qué sucede cuando un registro cambia de 16 a 8 bits? ===&lt;br /&gt;
En el caso del registro A, el High byte del registro queda en el mismo valor que cuando estaba en 16 bits y luego todas las operaciones que hagas serán usando el Low Byte del registro A. Ejemplo si A fuera FC08, al pasarlo a 8 bits, seguiría teniendo el valor FC08, y luego si hicieras algo como LDA #$02, solo cambiaría el Low byte, quedando FC02.&lt;br /&gt;
En el caso del registro X e Y, el High byte pasa a 00 cuando se pasa a 8 bits y luego cualquier operación que se haga afecta solo al Low Byte. Ejemplo, si X fuera FC08, al pasarlo a 8 bits sería 0008, luego si hicieras algo como LDX #$02, solo cambiaría el Low byte, quedando 0002.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Aritméticas ==&lt;br /&gt;
Las operaciones aritméticas nos permiten en la SNES hacer sumas y restas, el Super Nintendo no tiene un comando para hacer multiplicaciones o divisiones, sino que usa un sistema aparte para realizar estas operaciones y que se verán a mayor profundidad en otro capítulo.&lt;br /&gt;
Los comandos aritméticos son:&lt;br /&gt;
* &#039;&#039;&#039;ADC:&#039;&#039;&#039; Suma el valor del registro A con el parámetro del comando, si el flag C es 1, se le añade 1 a la suma.&lt;br /&gt;
* &#039;&#039;&#039;SBC:&#039;&#039;&#039; Resta el valor del registro A con el parámetro del comando, si el flag C es 0, se le resta 1 más a la resta.&lt;br /&gt;
* &#039;&#039;&#039;INC:&#039;&#039;&#039; Incrementa lo que está en el parámetro en 1, INC A incrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;INX, INY:&#039;&#039;&#039; Incrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
* &#039;&#039;&#039;DEC:&#039;&#039;&#039; Decrementa lo que está en el parámetro en 1, INC A Decrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;DEX, DEY:&#039;&#039;&#039; Decrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
&lt;br /&gt;
Todos estos comandos pueden afectar al flag N si es que el resultado es negativo o no y al flag Z si el resultado es cero o no.&lt;br /&gt;
El comando ADC y SBC pueden afectar al flag V y C, la forma en que afectan es:&lt;br /&gt;
* El flag V se activa cuando una operación (suma o resta) que debiera dar un valor negativo, da un valor positivo, o debiera dar un valor positivo, pero da un valor negativo. Por ejemplo:&lt;br /&gt;
** Si al sumar 2 números positivos da un valor negativo, por ejemplo si sumas 0x7F con 0x02, ambos son positivos, pero el resultado es 0x81 que es -127, en este caso se activa el flag V.&lt;br /&gt;
** Si al sumar 2 números negativos se pasa da un valor positivo, por ejemplo si sumas 0x80 con 0xFE, ambos son negativos, pero el resultado da 0x7E que es positivo, en este caso se activa el flag V.&lt;br /&gt;
* El flag C se activa cuando el resultado de una suma da un valor mayor al límite del registro o cuando al hacer una resta, el valor que se resta es mayor que el valor en el registro A. Por ejemplo:&lt;br /&gt;
** A de 8 bits, se suma 0xFE con 0x02, esto da 0x100, pero esto no cabe en 8 bits, así que A seria 0x00 y el flag C se activa.&lt;br /&gt;
** A de 8 bits, a 0x03 se le resta 0x06, esto da 0xFD y activará el flag C.&lt;br /&gt;
&lt;br /&gt;
Para la operación ADC lo recomendable sería antes del comando usar el comando CLC para que no añada 1 extra, en el caso de SBC, lo ideal sería antes del comando usar el comando SEC para que no reste 1 extra. Ejemplos&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA #$01&lt;br /&gt;
CLC&lt;br /&gt;
ADC #$02 ;1 + 2 = 3&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
SEC&lt;br /&gt;
SBC #$01 ;2 - 1 = 1&lt;br /&gt;
&lt;br /&gt;
LDA #$01&lt;br /&gt;
SEC&lt;br /&gt;
ADC #$02 ;1 + 2 + 1 = 4&lt;br /&gt;
&lt;br /&gt;
LDA #$02&lt;br /&gt;
CLC&lt;br /&gt;
SBC #$01 ;2 - 1 - 1 = 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Operaciones Lógicas ==&lt;br /&gt;
&lt;br /&gt;
== Operaciones Shift y Rotate ==&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20755</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20755"/>
		<updated>2025-02-18T17:05:53Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Operaciones Aritméticas */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|ASMTutorial}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* Binario: Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #%00001000 (seria el valor 8)&lt;br /&gt;
* Hexadecimal: Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #$10 (sería el valor 16)&lt;br /&gt;
* Decimal: Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* &#039;&#039;&#039;Bank:&#039;&#039;&#039; Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* &#039;&#039;&#039;High Byte:&#039;&#039;&#039; Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* &#039;&#039;&#039;Low Byte:&#039;&#039;&#039; este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* &#039;&#039;&#039;$7E-$7F:&#039;&#039;&#039; son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* &#039;&#039;&#039;$00-$3F:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$80-$CF:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$70-$71:&#039;&#039;&#039; SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* &#039;&#039;&#039;LDA:&#039;&#039;&#039; Guarda un valor en el registro A.&lt;br /&gt;
* &#039;&#039;&#039;LDX:&#039;&#039;&#039; Guarda un valor en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY:&#039;&#039;&#039; Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* &#039;&#039;&#039;STA:&#039;&#039;&#039; Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STX:&#039;&#039;&#039; Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STY:&#039;&#039;&#039; Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STZ:&#039;&#039;&#039; Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* &#039;&#039;&#039;LDX #$A0:&#039;&#039;&#039; Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY $7890:&#039;&#039;&#039; Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* &#039;&#039;&#039;LDA ($00):&#039;&#039;&#039; Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* &#039;&#039;&#039;STX $4567:&#039;&#039;&#039; Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* &#039;&#039;&#039;STA ($00):&#039;&#039;&#039; Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;br /&gt;
&lt;br /&gt;
= Registro de Status y  Operaciones Aritméticas y Lógicas =&lt;br /&gt;
== Registro de Status ==&lt;br /&gt;
El Registro de Status también llamado Registro P, es un registro especial de la SNES, este se encarga de guardar el estado actual de la ALU (Unidad Aritmética Lógica), de acá podemos extraer información que nos puede ayudar en combinación de ciertos comandos, también podemos utilizarlo para que los registro A, X e Y puedan cambiar entre modo de 8 bits y 16 bits.&lt;br /&gt;
El registro P tiene los siguientes bits o flags:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Status Flags&lt;br /&gt;
|-&lt;br /&gt;
! Flag !! Valor !! Descripción&lt;br /&gt;
|-&lt;br /&gt;
| N || #$80 || Si el flag es 1, la última operación dio un resultado con valor negativo. Los números negativos van desde -1 (0xFF) a -128 (0x80), si el valor es 0 entonces el último resultado fue positivo.&lt;br /&gt;
|-&lt;br /&gt;
| V || #$40 || Si el flag es 1, significa que la última operación de forma errónea paso de un número negativo a uno positivo o viceversa, se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|-&lt;br /&gt;
| M || #$20 || Si el flag es 1, significa que el registro A es de 8 bits, sino es de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| X || #$10 || Si el flag es 1, significa que el registro X e Y son de 8 bits, sino son de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| D || #$08 || Si el flag es 1, significa que las operaciones aritméticas se harán como si fuera una operación con números en base 10, sino usa base 16.&lt;br /&gt;
|-&lt;br /&gt;
| I || #$04 || Si el flag es 1, significa que el hardware está en una Interrupción, esto es algo avanzado y se explicará en otro capitulo a futuro.&lt;br /&gt;
|-&lt;br /&gt;
| Z || #$02 || Si el flag es 1, significa que el último resultado de una operación dio el valor cero.&lt;br /&gt;
|-&lt;br /&gt;
| C || #$01 || Si el flag es 1, significa que la última operación superó el límite que el registro podía abarcar, esto se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|}&lt;br /&gt;
Estos serían todos los flags que necesitaremos del registro P.&lt;br /&gt;
Existen 2 comandos especiales para escribir valores en el registro P.&lt;br /&gt;
* &#039;&#039;&#039;REP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 0, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
* &#039;&#039;&#039;SEP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 1, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
Ejemplos de uso:&lt;br /&gt;
* &#039;&#039;&#039;REP #$20:&#039;&#039;&#039; Pone en cero el flag M, por lo tanto haría que el registro A sea de 16 bits.&lt;br /&gt;
* &#039;&#039;&#039;SEP #$20:&#039;&#039;&#039; Pone en 1 el flag M, por lo tanto haría que el registro A sea de 8 bits.&lt;br /&gt;
&lt;br /&gt;
Con los comandos REP y SEP se puede alterar cualquiera de los flags, aunque también existen otros comandos alternativos que pueden hacer lo mismo para algunos flags específicos. Estos son:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;CLV:&#039;&#039;&#039; Pone el Flag V y lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEC y CLC:&#039;&#039;&#039; SEC pone el Flag C en 1 y CLC lo pone  en 0.&lt;br /&gt;
* &#039;&#039;&#039;SED y CLD:&#039;&#039;&#039; SED pone el Flag D en 1 y CLD lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEI y CLI:&#039;&#039;&#039; SEI pone el Flag I en 1 y CLI lo pone en 0.&lt;br /&gt;
&lt;br /&gt;
Estos comandos en general no tienen ninguna ventaja en términos de performance con REP y SEP, aunque pueden servir debido a que usan 1 byte en vez de 2, también es más fácil memorizarlos en general.&lt;br /&gt;
&lt;br /&gt;
=== ¿Qué sucede cuando un registro cambia de 16 a 8 bits? ===&lt;br /&gt;
En el caso del registro A, el High byte del registro queda en el mismo valor que cuando estaba en 16 bits y luego todas las operaciones que hagas serán usando el Low Byte del registro A. Ejemplo si A fuera FC08, al pasarlo a 8 bits, seguiría teniendo el valor FC08, y luego si hicieras algo como LDA #$02, solo cambiaría el Low byte, quedando FC02.&lt;br /&gt;
En el caso del registro X e Y, el High byte pasa a 00 cuando se pasa a 8 bits y luego cualquier operación que se haga afecta solo al Low Byte. Ejemplo, si X fuera FC08, al pasarlo a 8 bits sería 0008, luego si hicieras algo como LDX #$02, solo cambiaría el Low byte, quedando 0002.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Aritméticas ==&lt;br /&gt;
Las operaciones aritméticas nos permiten en la SNES hacer sumas y restas, el Super Nintendo no tiene un comando para hacer multiplicaciones o divisiones, sino que usa un sistema aparte para realizar estas operaciones y que se verán a mayor profundidad en otro capítulo.&lt;br /&gt;
Los comandos aritméticos son:&lt;br /&gt;
* &#039;&#039;&#039;ADC:&#039;&#039;&#039; Suma el valor del registro A con el parámetro del comando, si el flag C es 1, se le añade 1 a la suma.&lt;br /&gt;
* &#039;&#039;&#039;SBC:&#039;&#039;&#039; Resta el valor del registro A con el parámetro del comando, si el flag C es 0, se le resta 1 más a la resta.&lt;br /&gt;
* &#039;&#039;&#039;INC:&#039;&#039;&#039; Incrementa lo que está en el parámetro en 1, INC A incrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;INX, INY:&#039;&#039;&#039; Incrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
* &#039;&#039;&#039;DEC:&#039;&#039;&#039; Decrementa lo que está en el parámetro en 1, INC A Decrementa el registro A en 1.&lt;br /&gt;
* &#039;&#039;&#039;DEX, DEY:&#039;&#039;&#039; Decrementa en 1 el registro X (INX) o el registro Y (INY).&lt;br /&gt;
&lt;br /&gt;
Todos estos comandos pueden afectar al flag N si es que el resultado es negativo o no y al flag Z si el resultado es cero o no.&lt;br /&gt;
El comando ADC y SBC pueden afectar al flag V y C, la forma en que afectan es:&lt;br /&gt;
* El flag V se activa cuando una operación (suma o resta) que debiera dar un valor negativo, da un valor positivo, o debiera dar un valor positivo, pero da un valor negativo. Por ejemplo:&lt;br /&gt;
** Si al sumar 2 números positivos da un valor negativo, por ejemplo si sumas 0x7F con 0x02, ambos son positivos, pero el resultado es 0x81 que es -127, en este caso se activa el flag V.&lt;br /&gt;
** Si al sumar 2 números negativos se pasa da un valor positivo, por ejemplo si sumas 0x80 con 0xFE, ambos son negativos, pero el resultado da 0x7E que es positivo, en este caso se activa el flag V.&lt;br /&gt;
* El flag C se activa cuando el resultado de una suma da un valor mayor al límite del registro o cuando al hacer una resta, el valor que se resta es mayor que el valor en el registro A. Por ejemplo:&lt;br /&gt;
** A de 8 bits, se suma 0xFE con 0x02, esto da 0x100, pero esto no cabe en 8 bits, así que A seria 0x00 y el flag C se activa.&lt;br /&gt;
** A de 8 bits, a 0x03 se le resta 0x06, esto da 0xFD y activará el flag C.&lt;br /&gt;
&lt;br /&gt;
Para la operación ADC lo recomendable sería antes del comando usar el comando CLC para que no añada 1 extra, en el caso de SBC, lo ideal sería antes del comando usar el comando SEC para que no reste 1 extra. Ejemplos&lt;br /&gt;
&lt;br /&gt;
== Operaciones Lógicas ==&lt;br /&gt;
&lt;br /&gt;
== Operaciones Shift y Rotate ==&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20754</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20754"/>
		<updated>2025-02-18T17:04:08Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Registro de Status */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|ASMTutorial}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* Binario: Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #%00001000 (seria el valor 8)&lt;br /&gt;
* Hexadecimal: Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #$10 (sería el valor 16)&lt;br /&gt;
* Decimal: Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* &#039;&#039;&#039;Bank:&#039;&#039;&#039; Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* &#039;&#039;&#039;High Byte:&#039;&#039;&#039; Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* &#039;&#039;&#039;Low Byte:&#039;&#039;&#039; este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* &#039;&#039;&#039;$7E-$7F:&#039;&#039;&#039; son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* &#039;&#039;&#039;$00-$3F:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$80-$CF:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$70-$71:&#039;&#039;&#039; SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* &#039;&#039;&#039;LDA:&#039;&#039;&#039; Guarda un valor en el registro A.&lt;br /&gt;
* &#039;&#039;&#039;LDX:&#039;&#039;&#039; Guarda un valor en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY:&#039;&#039;&#039; Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* &#039;&#039;&#039;STA:&#039;&#039;&#039; Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STX:&#039;&#039;&#039; Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STY:&#039;&#039;&#039; Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STZ:&#039;&#039;&#039; Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* &#039;&#039;&#039;LDX #$A0:&#039;&#039;&#039; Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY $7890:&#039;&#039;&#039; Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* &#039;&#039;&#039;LDA ($00):&#039;&#039;&#039; Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* &#039;&#039;&#039;STX $4567:&#039;&#039;&#039; Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* &#039;&#039;&#039;STA ($00):&#039;&#039;&#039; Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;br /&gt;
&lt;br /&gt;
= Registro de Status y  Operaciones Aritméticas y Lógicas =&lt;br /&gt;
== Registro de Status ==&lt;br /&gt;
El Registro de Status también llamado Registro P, es un registro especial de la SNES, este se encarga de guardar el estado actual de la ALU (Unidad Aritmética Lógica), de acá podemos extraer información que nos puede ayudar en combinación de ciertos comandos, también podemos utilizarlo para que los registro A, X e Y puedan cambiar entre modo de 8 bits y 16 bits.&lt;br /&gt;
El registro P tiene los siguientes bits o flags:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Status Flags&lt;br /&gt;
|-&lt;br /&gt;
! Flag !! Valor !! Descripción&lt;br /&gt;
|-&lt;br /&gt;
| N || #$80 || Si el flag es 1, la última operación dio un resultado con valor negativo. Los números negativos van desde -1 (0xFF) a -128 (0x80), si el valor es 0 entonces el último resultado fue positivo.&lt;br /&gt;
|-&lt;br /&gt;
| V || #$40 || Si el flag es 1, significa que la última operación de forma errónea paso de un número negativo a uno positivo o viceversa, se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|-&lt;br /&gt;
| M || #$20 || Si el flag es 1, significa que el registro A es de 8 bits, sino es de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| X || #$10 || Si el flag es 1, significa que el registro X e Y son de 8 bits, sino son de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| D || #$08 || Si el flag es 1, significa que las operaciones aritméticas se harán como si fuera una operación con números en base 10, sino usa base 16.&lt;br /&gt;
|-&lt;br /&gt;
| I || #$04 || Si el flag es 1, significa que el hardware está en una Interrupción, esto es algo avanzado y se explicará en otro capitulo a futuro.&lt;br /&gt;
|-&lt;br /&gt;
| Z || #$02 || Si el flag es 1, significa que el último resultado de una operación dio el valor cero.&lt;br /&gt;
|-&lt;br /&gt;
| C || #$01 || Si el flag es 1, significa que la última operación superó el límite que el registro podía abarcar, esto se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|}&lt;br /&gt;
Estos serían todos los flags que necesitaremos del registro P.&lt;br /&gt;
Existen 2 comandos especiales para escribir valores en el registro P.&lt;br /&gt;
* &#039;&#039;&#039;REP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 0, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
* &#039;&#039;&#039;SEP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 1, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
Ejemplos de uso:&lt;br /&gt;
* &#039;&#039;&#039;REP #$20:&#039;&#039;&#039; Pone en cero el flag M, por lo tanto haría que el registro A sea de 16 bits.&lt;br /&gt;
* &#039;&#039;&#039;SEP #$20:&#039;&#039;&#039; Pone en 1 el flag M, por lo tanto haría que el registro A sea de 8 bits.&lt;br /&gt;
&lt;br /&gt;
Con los comandos REP y SEP se puede alterar cualquiera de los flags, aunque también existen otros comandos alternativos que pueden hacer lo mismo para algunos flags específicos. Estos son:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;CLV:&#039;&#039;&#039; Pone el Flag V y lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEC y CLC:&#039;&#039;&#039; SEC pone el Flag C en 1 y CLC lo pone  en 0.&lt;br /&gt;
* &#039;&#039;&#039;SED y CLD:&#039;&#039;&#039; SED pone el Flag D en 1 y CLD lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEI y CLI:&#039;&#039;&#039; SEI pone el Flag I en 1 y CLI lo pone en 0.&lt;br /&gt;
&lt;br /&gt;
Estos comandos en general no tienen ninguna ventaja en términos de performance con REP y SEP, aunque pueden servir debido a que usan 1 byte en vez de 2, también es más fácil memorizarlos en general.&lt;br /&gt;
&lt;br /&gt;
=== ¿Qué sucede cuando un registro cambia de 16 a 8 bits? ===&lt;br /&gt;
En el caso del registro A, el High byte del registro queda en el mismo valor que cuando estaba en 16 bits y luego todas las operaciones que hagas serán usando el Low Byte del registro A. Ejemplo si A fuera FC08, al pasarlo a 8 bits, seguiría teniendo el valor FC08, y luego si hicieras algo como LDA #$02, solo cambiaría el Low byte, quedando FC02.&lt;br /&gt;
En el caso del registro X e Y, el High byte pasa a 00 cuando se pasa a 8 bits y luego cualquier operación que se haga afecta solo al Low Byte. Ejemplo, si X fuera FC08, al pasarlo a 8 bits sería 0008, luego si hicieras algo como LDX #$02, solo cambiaría el Low byte, quedando 0002.&lt;br /&gt;
&lt;br /&gt;
== Operaciones Aritméticas ==&lt;br /&gt;
&lt;br /&gt;
== Operaciones Lógicas ==&lt;br /&gt;
&lt;br /&gt;
== Operaciones Shift y Rotate ==&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20753</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20753"/>
		<updated>2025-02-18T17:02:48Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Registro de Status y  Operaciones Aritméticas y Lógicas */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|ASMTutorial}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* Binario: Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #%00001000 (seria el valor 8)&lt;br /&gt;
* Hexadecimal: Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #$10 (sería el valor 16)&lt;br /&gt;
* Decimal: Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* &#039;&#039;&#039;Bank:&#039;&#039;&#039; Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* &#039;&#039;&#039;High Byte:&#039;&#039;&#039; Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* &#039;&#039;&#039;Low Byte:&#039;&#039;&#039; este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* &#039;&#039;&#039;$7E-$7F:&#039;&#039;&#039; son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* &#039;&#039;&#039;$00-$3F:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$80-$CF:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$70-$71:&#039;&#039;&#039; SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* &#039;&#039;&#039;LDA:&#039;&#039;&#039; Guarda un valor en el registro A.&lt;br /&gt;
* &#039;&#039;&#039;LDX:&#039;&#039;&#039; Guarda un valor en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY:&#039;&#039;&#039; Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* &#039;&#039;&#039;STA:&#039;&#039;&#039; Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STX:&#039;&#039;&#039; Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STY:&#039;&#039;&#039; Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STZ:&#039;&#039;&#039; Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* &#039;&#039;&#039;LDX #$A0:&#039;&#039;&#039; Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY $7890:&#039;&#039;&#039; Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* &#039;&#039;&#039;LDA ($00):&#039;&#039;&#039; Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* &#039;&#039;&#039;STX $4567:&#039;&#039;&#039; Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* &#039;&#039;&#039;STA ($00):&#039;&#039;&#039; Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;br /&gt;
&lt;br /&gt;
= Registro de Status y  Operaciones Aritméticas y Lógicas =&lt;br /&gt;
== Registro de Status ==&lt;br /&gt;
El Registro de Status también llamado Registro P, es un registro especial de la SNES, este se encarga de guardar el estado actual de la ALU (Unidad Aritmética Lógica), de acá podemos extraer información que nos puede ayudar en combinación de ciertos comandos, también podemos utilizarlo para que los registro A, X e Y puedan cambiar entre modo de 8 bits y 16 bits.&lt;br /&gt;
El registro P tiene los siguientes bits o flags:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Status Flags&lt;br /&gt;
|-&lt;br /&gt;
! Flag !! Valor !! Descripción&lt;br /&gt;
|-&lt;br /&gt;
| N || #$80 || Si el flag es 1, la última operación dio un resultado con valor negativo. Los números negativos van desde -1 (0xFF) a -128 (0x80), si el valor es 0 entonces el último resultado fue positivo.&lt;br /&gt;
|-&lt;br /&gt;
| V || #$40 || Si el flag es 1, significa que la última operación de forma errónea paso de un número negativo a uno positivo o viceversa, se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|-&lt;br /&gt;
| M || #$20 || Si el flag es 1, significa que el registro A es de 8 bits, sino es de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| X || #$10 || Si el flag es 1, significa que el registro X e Y son de 8 bits, sino son de 16 bits.&lt;br /&gt;
|-&lt;br /&gt;
| D || #$08 || Si el flag es 1, significa que las operaciones aritméticas se harán como si fuera una operación con números en base 10, sino usa base 16.&lt;br /&gt;
|-&lt;br /&gt;
| I || #$04 || Si el flag es 1, significa que el hardware está en una Interrupción, esto es algo avanzado y se explicará en otro capitulo a futuro.&lt;br /&gt;
|-&lt;br /&gt;
| Z || #$02 || Si el flag es 1, significa que el último resultado de una operación dio el valor cero.&lt;br /&gt;
|-&lt;br /&gt;
| C || #$01 || Si el flag es 1, significa que la última operación superó el límite que el registro podía abarcar, esto se explicará a más profundidad cuando hablemos de operaciones aritméticas.&lt;br /&gt;
|}&lt;br /&gt;
Estos serían todos los flags que necesitaremos del registro P.&lt;br /&gt;
Existen 2 comandos especiales para escribir valores en el registro P.&lt;br /&gt;
* &#039;&#039;&#039;REP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 0, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
* &#039;&#039;&#039;SEP:&#039;&#039;&#039; Recibe como parámetro una constante, pone en 1, los bits que en el parámetro del comando sean 1.&lt;br /&gt;
Ejemplos de uso:&lt;br /&gt;
* &#039;&#039;&#039;REP #$20:&#039;&#039;&#039; Pone en cero el flag M, por lo tanto haría que el registro A sea de 16 bits.&lt;br /&gt;
* &#039;&#039;&#039;SEP #$20:&#039;&#039;&#039; Pone en 1 el flag M, por lo tanto haría que el registro A sea de 8 bits.&lt;br /&gt;
&lt;br /&gt;
Con los comandos REP y SEP se puede alterar cualquiera de los flags, aunque también existen otros comandos alternativos que pueden hacer lo mismo para algunos flags específicos. Estos son:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;CLV:&#039;&#039;&#039; Pone el Flag V y lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEC y CLC:&#039;&#039;&#039; SEC pone el Flag C en 1 y CLC lo pone  en 0.&lt;br /&gt;
* &#039;&#039;&#039;SED y CLD:&#039;&#039;&#039; SED pone el Flag D en 1 y CLD lo pone en 0.&lt;br /&gt;
* &#039;&#039;&#039;SEI y CLI:&#039;&#039;&#039; SEI pone el Flag I en 1 y CLI lo pone en 0.&lt;br /&gt;
&lt;br /&gt;
Estos comandos en general no tienen ninguna ventaja en términos de performance con REP y SEP, aunque pueden servir debido a que usan 1 byte en vez de 2, también es más fácil memorizarlos en general.&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20752</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20752"/>
		<updated>2025-02-18T16:56:37Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|ASMTutorial}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* Binario: Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #%00001000 (seria el valor 8)&lt;br /&gt;
* Hexadecimal: Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #$10 (sería el valor 16)&lt;br /&gt;
* Decimal: Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* &#039;&#039;&#039;Bank:&#039;&#039;&#039; Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* &#039;&#039;&#039;High Byte:&#039;&#039;&#039; Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* &#039;&#039;&#039;Low Byte:&#039;&#039;&#039; este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* &#039;&#039;&#039;$7E-$7F:&#039;&#039;&#039; son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* &#039;&#039;&#039;$00-$3F:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$80-$CF:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$70-$71:&#039;&#039;&#039; SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* &#039;&#039;&#039;LDA:&#039;&#039;&#039; Guarda un valor en el registro A.&lt;br /&gt;
* &#039;&#039;&#039;LDX:&#039;&#039;&#039; Guarda un valor en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY:&#039;&#039;&#039; Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* &#039;&#039;&#039;STA:&#039;&#039;&#039; Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STX:&#039;&#039;&#039; Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STY:&#039;&#039;&#039; Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STZ:&#039;&#039;&#039; Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* &#039;&#039;&#039;LDX #$A0:&#039;&#039;&#039; Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY $7890:&#039;&#039;&#039; Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* &#039;&#039;&#039;LDA ($00):&#039;&#039;&#039; Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* &#039;&#039;&#039;STX $4567:&#039;&#039;&#039; Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* &#039;&#039;&#039;STA ($00):&#039;&#039;&#039; Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;br /&gt;
&lt;br /&gt;
= Registro de Status y  Operaciones Aritméticas y Lógicas =&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20751</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20751"/>
		<updated>2025-02-18T16:55:48Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Load y Store */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* Binario: Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #%00001000 (seria el valor 8)&lt;br /&gt;
* Hexadecimal: Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #$10 (sería el valor 16)&lt;br /&gt;
* Decimal: Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* &#039;&#039;&#039;Bank:&#039;&#039;&#039; Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* &#039;&#039;&#039;High Byte:&#039;&#039;&#039; Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* &#039;&#039;&#039;Low Byte:&#039;&#039;&#039; este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* &#039;&#039;&#039;$7E-$7F:&#039;&#039;&#039; son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* &#039;&#039;&#039;$00-$3F:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$80-$CF:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$70-$71:&#039;&#039;&#039; SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* &#039;&#039;&#039;LDA:&#039;&#039;&#039; Guarda un valor en el registro A.&lt;br /&gt;
* &#039;&#039;&#039;LDX:&#039;&#039;&#039; Guarda un valor en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY:&#039;&#039;&#039; Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* &#039;&#039;&#039;STA:&#039;&#039;&#039; Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STX:&#039;&#039;&#039; Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STY:&#039;&#039;&#039; Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STZ:&#039;&#039;&#039; Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* &#039;&#039;&#039;LDX #$A0:&#039;&#039;&#039; Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY $7890:&#039;&#039;&#039; Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* &#039;&#039;&#039;LDA ($00):&#039;&#039;&#039; Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* &#039;&#039;&#039;STX $4567:&#039;&#039;&#039; Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* &#039;&#039;&#039;STA ($00):&#039;&#039;&#039; Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;br /&gt;
&lt;br /&gt;
= Registro de Status y  Operaciones Aritméticas y Lógicas =&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20750</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20750"/>
		<updated>2025-02-18T16:54:55Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Load y Store */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* Binario: Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #%00001000 (seria el valor 8)&lt;br /&gt;
* Hexadecimal: Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #$10 (sería el valor 16)&lt;br /&gt;
* Decimal: Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* &#039;&#039;&#039;Bank:&#039;&#039;&#039; Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* &#039;&#039;&#039;High Byte:&#039;&#039;&#039; Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* &#039;&#039;&#039;Low Byte:&#039;&#039;&#039; este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* &#039;&#039;&#039;$7E-$7F:&#039;&#039;&#039; son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* &#039;&#039;&#039;$00-$3F:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$80-$CF:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$70-$71:&#039;&#039;&#039; SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* &#039;&#039;&#039;LDA:&#039;&#039;&#039; Guarda un valor en el registro A.&lt;br /&gt;
* &#039;&#039;&#039;LDX:&#039;&#039;&#039; Guarda un valor en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY:&#039;&#039;&#039; Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* &#039;&#039;&#039;STA:&#039;&#039;&#039; Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STX:&#039;&#039;&#039; Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STY:&#039;&#039;&#039; Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* &#039;&#039;&#039;STZ:&#039;&#039;&#039; Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* &#039;&#039;&#039;LDX #$A0:&#039;&#039;&#039; Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* &#039;&#039;&#039;LDY $7890:&#039;&#039;&#039; Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* &#039;&#039;&#039;LDA ($00):&#039;&#039;&#039; Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* &#039;&#039;&#039;STX $4567:&#039;&#039;&#039; Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* &#039;&#039;&#039;STA ($00):&#039;&#039;&#039; Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039;&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20749</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20749"/>
		<updated>2025-02-18T16:53:31Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Memoria RAM y ROM */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* Binario: Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #%00001000 (seria el valor 8)&lt;br /&gt;
* Hexadecimal: Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #$10 (sería el valor 16)&lt;br /&gt;
* Decimal: Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* &#039;&#039;&#039;Bank:&#039;&#039;&#039; Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* &#039;&#039;&#039;High Byte:&#039;&#039;&#039; Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* &#039;&#039;&#039;Low Byte:&#039;&#039;&#039; este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* &#039;&#039;&#039;$7E-$7F:&#039;&#039;&#039; son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* &#039;&#039;&#039;$00-$3F:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$80-$CF:&#039;&#039;&#039; ROM.&lt;br /&gt;
* &#039;&#039;&#039;$70-$71:&#039;&#039;&#039; SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* LDA: Guarda un valor en el registro A.&lt;br /&gt;
* LDX: Guarda un valor en el registro X.&lt;br /&gt;
* LDY: Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* STA: Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* STX: Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* STY: Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* STZ: Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* LDX #$A0: Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* LDY $7890: Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* LDA ($00): Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** Ejemplo:&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* STX $4567: Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* STA ($00): Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** Ejemplo:&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20748</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20748"/>
		<updated>2025-02-18T16:52:44Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Constantes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* Binario: Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #%00001000 (seria el valor 8)&lt;br /&gt;
* Hexadecimal: Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #$10 (sería el valor 16)&lt;br /&gt;
* Decimal: Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** &#039;&#039;&#039;Ejemplo:&#039;&#039;&#039; #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* Bank: Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* High Byte: Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* Low Byte: este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* $7E-$7F son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* $00-$3F: ROM.&lt;br /&gt;
* $80-$CF: ROM.&lt;br /&gt;
* $70-$71: SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* LDA: Guarda un valor en el registro A.&lt;br /&gt;
* LDX: Guarda un valor en el registro X.&lt;br /&gt;
* LDY: Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* STA: Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* STX: Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* STY: Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* STZ: Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* LDX #$A0: Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* LDY $7890: Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* LDA ($00): Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** Ejemplo:&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* STX $4567: Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* STA ($00): Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** Ejemplo:&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20747</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20747"/>
		<updated>2025-02-18T16:52:22Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Registros de la SNES */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* &#039;&#039;&#039;A:&#039;&#039;&#039; el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* &#039;&#039;&#039;X e Y:&#039;&#039;&#039; estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* Binario: Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** Ejemplo: #%00001000 (seria el valor 8)&lt;br /&gt;
* Hexadecimal: Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** Ejemplo: #$10 (sería el valor 16)&lt;br /&gt;
* Decimal: Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** Ejemplo: #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* Bank: Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* High Byte: Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* Low Byte: este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* $7E-$7F son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* $00-$3F: ROM.&lt;br /&gt;
* $80-$CF: ROM.&lt;br /&gt;
* $70-$71: SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* LDA: Guarda un valor en el registro A.&lt;br /&gt;
* LDX: Guarda un valor en el registro X.&lt;br /&gt;
* LDY: Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* STA: Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* STX: Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* STY: Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* STZ: Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* LDX #$A0: Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* LDY $7890: Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* LDA ($00): Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** Ejemplo:&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* STX $4567: Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* STA ($00): Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** Ejemplo:&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20746</id>
		<title>es/ASMTutorial</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/ASMTutorial&amp;diff=20746"/>
		<updated>2025-02-18T16:51:42Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: Created page with &amp;quot;{{Select Language|Dynamic_X}} = Conceptos Básicos = == ¿Qué es Assembly? == El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa. En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.  == Registros de la SNES == Un registro es un componente de hardware que almacena de manera mom...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
= Conceptos Básicos =&lt;br /&gt;
== ¿Qué es Assembly? ==&lt;br /&gt;
El lenguaje ensamblador (Assembly o ASM), es utilizado para darle comandos al hardware, este se traduce directamente a una secuencia de números binarios que luego es leído por el hardware para ejecutar la lógica del programa.&lt;br /&gt;
En estos tutoriales se enseñará ASM 65816 que es el assembly de SNES.&lt;br /&gt;
&lt;br /&gt;
== Registros de la SNES ==&lt;br /&gt;
Un registro es un componente de hardware que almacena de manera momentánea un valor específico. Estos se utilizan generalmente para:&lt;br /&gt;
* Operaciones aritméticas (como sumar o restar)&lt;br /&gt;
* Operaciones lógicas (comparaciones o lógica binaria Bitwise)&lt;br /&gt;
* Saltos (ir a otra zona del código)&lt;br /&gt;
* Indexación (poder llamar distintos valores de una tabla)&lt;br /&gt;
&lt;br /&gt;
En el SNES en específico tenemos 3 registros, todos pueden ser de 8 (permite valores entre 0 y 255) o 16 bits (permite valores entre 0 y 65535)::&lt;br /&gt;
* A : el registro principal, es el único que tiene operaciones aritméticas y lógicas como sumar, restar u operaciones bitwise.&lt;br /&gt;
* X e Y: estos 2 registros son de indexación y se usan en general para poder acceder a distintos valores de una tabla o como índices en un bucle.&lt;br /&gt;
&lt;br /&gt;
== Constantes ==&lt;br /&gt;
En el SNES puedes utilizar constantes para escribir valores en registros o en direcciones de memoria RAM. Para declarar una constante debe ir primero el carácter “#” y luego el valor de la constante.&lt;br /&gt;
Estas constantes pueden ser escritas en:&lt;br /&gt;
* Binario: Va con un carácter “%” al inicio, solo puede usar dígitos del 0 al 1.&lt;br /&gt;
** Ejemplo: #%00001000 (seria el valor 8)&lt;br /&gt;
* Hexadecimal: Va con un carácter “$” al inicio, puede usar dígitos del 0 al 9 o de “A” hasta “F”.&lt;br /&gt;
** Ejemplo: #$10 (sería el valor 16)&lt;br /&gt;
* Decimal: Va sin un carácter al inicio, puede usar dígitos del 0 al 9.&lt;br /&gt;
** Ejemplo: #10 (sería el valor 10)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nota:&#039;&#039;&#039; Dependiendo de si los registros son de 8 o 16 bits, las constantes deben adecuarse a esa cantidad de bits, por ejemplo, #$AA es de 8 bits y #$1000 es de 16 bits, si el registro fuera de 8 bits y cargas un valor de 16 bits esto podría generar errores, lo mismo si a un registro de 16 bits le pones un valor de 8 bits.&lt;br /&gt;
&lt;br /&gt;
== Memoria RAM y ROM ==&lt;br /&gt;
En el SNES la información del juego se guarda en la memoria RAM y ROM, la diferencia entre estos 2 tipos de memoria es la capacidad de escritura, la memoria ROM no puede ser modificada, mientras que la RAM si, por esto, la información del juego, como su lógica, gráficos, música, etc… Se guarda en ROM, mientras que la RAM se suele escribir a medida que el juego se ejecuta y se utiliza para las distintas variables que son requeridas por el juego.&lt;br /&gt;
Las direcciones de ROM y RAM son de 24 bits, por ejemplo:&lt;br /&gt;
* $123456&lt;br /&gt;
&lt;br /&gt;
En base a esto se puede dividir la dirección de memoria en 3 partes:&lt;br /&gt;
* Bank: Este corresponde al byte más alto de todos, en el ejemplo sería $12. La memoria está dividida en varios Banks de memoria, cada uno es de 32kb, a excepción de si se usa un Hirom, en este caso algunos de los banks serían de 64kb.&lt;br /&gt;
* High Byte: Este es el segundo byte más alto, en el ejemplo sería $34.&lt;br /&gt;
* Low Byte: este es el byte más bajo, en el ejemplo sería $56&lt;br /&gt;
&lt;br /&gt;
En  el SNES los Banks se pueden organizar de la siguiente manera:&lt;br /&gt;
* $7E-$7F son usados por la WRAM (Ram de Trabajo) que es la que guarda las variables en general.&lt;br /&gt;
* $00-$3F: ROM.&lt;br /&gt;
* $80-$CF: ROM.&lt;br /&gt;
* $70-$71: SRAM (RAM Estática) que es la que se utiliza normalmente para guardar la partida.&lt;br /&gt;
* Otros bancos pueden ser utilizados por distintos chips de expansión, por ejemplo el SA-1 puede usar el bank $40-$41 BWRAM que básicamente es una WRAM pero más rápida.&lt;br /&gt;
&lt;br /&gt;
== Load y Store ==&lt;br /&gt;
Las operaciones Load y Store son las más básicas, Load se utiliza para guardar un valor en un registro, mientras que Store se utiliza para guardar un valor de un registro en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
Comandos Load:&lt;br /&gt;
* LDA: Guarda un valor en el registro A.&lt;br /&gt;
* LDX: Guarda un valor en el registro X.&lt;br /&gt;
* LDY: Guarda un valor en el registro Y.&lt;br /&gt;
&lt;br /&gt;
Comandos Store:&lt;br /&gt;
* STA: Guarda el valor de A en una dirección de RAM.&lt;br /&gt;
* STX: Guarda el valor de X en una dirección de RAM.&lt;br /&gt;
* STY: Guarda el valor de Y en una dirección de RAM.&lt;br /&gt;
* STZ: Guarda el valor 0 en una dirección de RAM.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Load estos reciben como parámetro el valor que se guardara en el registro, este valor puede ser una constante, una dirección de RAM o de ROM, e incluso una indirección, Ejemplo:&lt;br /&gt;
* LDX #$A0: Guarda el valor 0xA0 (160) en el registro X.&lt;br /&gt;
* LDY $7890: Guarda el valor de la dirección de RAM $7890 en el registro Y. Por ejemplo si esta dirección tuviera el valor #$01, entonces Y tendría el valor 1.&lt;br /&gt;
* LDA ($00): Esto seria una indirección, se abordara a más profundidad más adelante, pero básicamente esto tomaría la dirección de memoria guardada en $00 y $01 (donde $01 seria el High byte y $00 el Low Byte), luego iría a esa dirección de memoria, obtendrá su valor y guardaría ese valor en el registro A.&lt;br /&gt;
** Ejemplo:&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, LDA ($00) iria a la dirección $5678 y luego tomaría el valor de esa dirección de RAM (que por ejemplo pudiera tener el valor #$10) y entonces A tendría el valor #$10 después de usar ese comando.&lt;br /&gt;
&lt;br /&gt;
En el caso de los comandos Store estos reciben como parámetro una dirección de RAM, ya sea, de manera directa o de forma indirecta, Ejemplo.&lt;br /&gt;
* STX $4567: Guardería el valor de X en la dirección de RAM $4567&lt;br /&gt;
* STA ($00): Similar al LDA ($00), se tomaría el valor de $00 y $01 para llegar a una dirección de RAM y luego se guardaría el valor de A en esa dirección de RAM.&lt;br /&gt;
** Ejemplo:&lt;br /&gt;
*** Si $00-$01 tuvieran el valor #$5678, STA ($00) iría a la dirección $5678 y luego guardaría el valor de A en la dirección $5678.&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15206</id>
		<title>Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15206"/>
		<updated>2024-02-03T14:28:50Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Dynamic Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X is an advanced dynamic load management system whose purpose is to support the transfer of graphics and color palettes to the VRAM and CGRAM respectively. This system would replace Dynamic Z V3.7 which in turn is a replacement for DSX.&lt;br /&gt;
== Download ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
= Features =&lt;br /&gt;
*Load Poses Dynamically: Allows to load poses for Dynamic Sprites from any ASM code.&lt;br /&gt;
*Draw Poses: Allows to draw any pose that is registered in the system anywhere on the screen and from any ASM code. The way of drawing is totally optimized for each pose, basically all the poses that have similar characteristics, use the same graphic routine to optimize cycles and to make it as efficient as possible, besides diminishing considerably the amount of ROM used in graphic routines, since, 1 graphic routine can draw hundreds of different poses that belong to different Sprites.&lt;br /&gt;
*Load Graphics to VRAM.&lt;br /&gt;
*Load Color Palettes to the CGRAM.&lt;br /&gt;
*Automatic Palette Assignment: When a Sprite loads a palette, it can ask the system to assign a palette in an automated way, it will look for a free palette and it can be used by the Sprite, in case the palette is already loaded in the loaded CGRAM then it will give the Sprite that palette. The system informs if there are no palettes available, this way, you can avoid that the Sprite tries to work with wrong palettes.&lt;br /&gt;
*Color Palette Effects: You can edit the palettes that are loaded to change attributes such as Hue, Saturation and Brightness, you can weight them with a preset color or de-power certain RGB or HSL channels.&lt;br /&gt;
*Registration of Graphics and Palettes: The system allows you to insert graphics and palettes in the ROM, when you do so, the position in which they were saved in the ROM are available and you can also know the ID with which it was registered in the system, you can use that ID to dynamically load those graphics. Dynamic X will take care of deleting the graphics and palettes previously saved by the system and insert the new graphics and palettes in a free place in the ROM.&lt;br /&gt;
== Features that may have compatibility issues ==&lt;br /&gt;
*Custom Player Graphics: Dynamic X allows you to either change the player graphics using an EXGFX similar to GFX32 being limited to use the size and number of poses of the Vanilla game or simply disable completely the dynamic loading of player graphics, yoshi or podoboos to make your own dynamic routine for a custom player without limitations of size or number of poses. This feature allows you to change the graphics at any time, so you could use different players in different levels or in different areas of the same level.&lt;br /&gt;
*Player Custom Palettes: Dynamic X allows you to change the player&#039;s color palette freely.&lt;br /&gt;
*Player DMA optimizations: Dynamic X decreases considerably the cycles used by the NMI handler, since, the player graphics, yoshi and podoboos are only loaded in the VRAM when they are required, not always as it happens in the Vanilla game. This also leaves you some extra tiles in SP1 in levels that don&#039;t use yoshi or podoboos, even an extra tile in levels that don&#039;t use the layer.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
= Installation =&lt;br /&gt;
== General Steps ==&lt;br /&gt;
Before installing Dynamic X.&lt;br /&gt;
# The ROM must have SA-1 Pack installed.&lt;br /&gt;
# Put all files with &amp;quot;.drawinfo&amp;quot; extension in the &amp;quot;DrawInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.dynamicinfo&amp;quot; extension in the &amp;quot;DynamicInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.paleffect&amp;quot; extension in the &amp;quot;PaletteEffects&amp;quot; folder.&lt;br /&gt;
# Put all resource files such as GFXs and Color Palettes with &amp;quot;.bin&amp;quot; extension in the &amp;quot;DynamicResources&amp;quot; folder.&lt;br /&gt;
== Using the Tool Directly ==&lt;br /&gt;
You can install Dynamic X by opening the file &amp;quot;DynamicXTool.exe&amp;quot;, it will open a console telling you what to type at any given moment. It will start asking you for the ROM paths, Pixi folder, UberasmTool or GPS (these last 3 are optional) and then it will ask you for the features you want to install, put &amp;quot;y&amp;quot; or &amp;quot;yes&amp;quot; to enable each feature and &amp;quot;n&amp;quot; or &amp;quot;no&amp;quot; to disable that feature.&lt;br /&gt;
Warning: Features such as Player Features and Status Bar Optimization, may have incompatibilities with other resources, so you should be careful when installing them. Be careful which features you install.&lt;br /&gt;
&lt;br /&gt;
== Using the Tool From Console ==&lt;br /&gt;
You must call the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ROM will install with the default settings if you have never done a previous installation, if you have done a previous installation, then the settings used in that installation will be used.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
In case you want to change the settings manually you must open the settings.json file that will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must change the parameters according to the settings you want.&lt;br /&gt;
= Formats =&lt;br /&gt;
== Dynamic Info ==&lt;br /&gt;
Files with extension &amp;quot;.dynamicinfo&amp;quot; are used to insert pose graphics, palettes and other resources into the ROM. They also include the information necessary for the poses to be loaded correctly into the VRAM.&lt;br /&gt;
&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Below this label goes each graphics file used to load dynamic poses. Example: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Below this label goes each color palette file used for dynamic poses. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Resources&#039;&#039;&#039;: Below this label goes each extra file that is used as a resource and that you want to insert into the ROM. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Resources:&lt;br /&gt;
	Geno.bin&lt;br /&gt;
	GenoPal.bin&lt;br /&gt;
	FireGenoPal.bin&lt;br /&gt;
	GenoPalPlayer2.bin&lt;br /&gt;
	FireGenoPalPlayer2.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesChunksSizes&#039;&#039;&#039;: Below this label goes 2 lines for each pose, the first line is a label describing the pose and the second line is 2 values, each of these values indicates how many 8x8 tiles are used in each chunk, each dynamic pose has 2 chunks of data generally (except some exceptions that may require only 1 chunk), the top chunk and the bottom chunk. The top chunk is all the 8x8 tiles that are before the last 8 pixels high line, while the bottom chunk is the last line. In the following example you can see 3 images, the left one is how the assembled image should look like, the second one is how it would look like in the VRAM and the third one is how it would be saved in the binary file, it would also show how the poses sizes of that pose are, which in this case would be 8 tiles of the top chunk and 8 tiles of the bottom chunk:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: For poses whose number of 8x8 tiles is divisible by 16, you can use only the top chunk that has all the tiles and the bottom chunk would be 0. For Example if you have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $10,$10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $20,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is better because can use less DMA Transfers. Also the second number never can be higher than $0F.&lt;br /&gt;
&lt;br /&gt;
== Draw Info ==&lt;br /&gt;
The files with extension &amp;quot;.drawinfo&amp;quot;, have the necessary information to draw poses, these poses can be dynamic or static poses. Dynamic X uses these files to generate optimized graphic routines for each pose, the tool detects if one of the tables is necessary or not, eliminates redundant data, pigeonholes each pose in a group that shares similar characteristics and then inserts a graphic routine for each group of poses that share similar characteristics.&lt;br /&gt;
The file format is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: If true it is dynamic, if false it is static, example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: It is a table that indicates which tiles each pose uses, in the case of the dynamic poses it must be considered that the tile of more superior to the left is the tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, this table contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; and the second line would be each one of the tiles used by the pose This table is optional and in case it is not, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the tiles of the pose. This table is optional and in case it is not present, it will use the value $00 for the tiles of the pose. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: It is a table that indicates the horizontal displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move horizontally each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped horizontally, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping. The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;YDisplacements&#039;&#039;&#039;: It is a table that indicates the vertical displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_YDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move vertically each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped vertically, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_YDispFlipY:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping. The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
YDisplacements:&lt;br /&gt;
Pose32x32_YDisp:&lt;br /&gt;
    db $00,$00,$10,$10&lt;br /&gt;
Pose32x32_YDispFlipY:&lt;br /&gt;
    db $10,$10,$00,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Sizes&#039;&#039;&#039;: Is a table indicating the size of each tile used, each value is &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for 8x8 tiles and &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for 16x16 tiles. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the size of each tile. This table is optional and in case it does not exist, it will use the value &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Sizes:&lt;br /&gt;
Pose32x32_Sizes:&lt;br /&gt;
    db $02,$02,$02,$02&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Properties&#039;&#039;&#039;: Is a table indicating the properties of each tile, the properties follow the format YXCCPPPT, where X is if the tile is flipped horizontally, Y is if the tile is flipped vertically, CC is the priority with respect to layer 1 and layer 2, where 00 is the lowest priority and 11 is the highest, CCC is the color palette used by the tile and T is 1 for using SP3/SP4 and 0 for SP1/SP2. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the property of each tile. This table is optional and in case it does not exist, it will use the value given in the &amp;lt;code&amp;gt;!PropParam&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Properties:&lt;br /&gt;
Pose32x32_Properties:&lt;br /&gt;
    db $20,$20,$20,$20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Palette Effect ==&lt;br /&gt;
The files with extension &amp;quot;.paleffect&amp;quot; are json files that are used for multiple color palette effects, both global and normal, these files can be created using the tool &amp;quot;Palette Effect Creator&amp;quot; that is included with Dynamic X.&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;Name&amp;quot;: ...,&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [...]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Name&#039;&#039;&#039;: This is the name of the color palette effect set. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Name&amp;quot;: &amp;quot;DecreaseSaturation&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Effects&#039;&#039;&#039;: It is a list with each of the color palette effects, these have 7 parameters, the first 3 are Channel1, Channel2 and Channel3 which are values between 0 and 31 that indicate the value of each channel, in the case of an RGB effect, Channel1 is R, Channel2 is G and channel3 is B, in the case of an HSL effect, Channel1 is H, Channel2 is S and Channel3 is L, then come 3 more values, the Ratio1, Ratio2 and Ratio3, each of these is a number between 0 and 31 indicating how much each Channel affects the colors of the color palette, where 0 is that it affects 0% and 31 is that it affects 100%, finally Channels is to indicate whether it is an RGB or HSL effect, 0 is RGB and 1 is HSL. The following example shows 2 HSL effects that decrease saturation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 30,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 31,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Palette Effect Creator ===&lt;br /&gt;
You can find the tool on the official Dynamic X website:&lt;br /&gt;
*[https://snestorage.com/index.php Palette Effect Creator]&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15205</id>
		<title>Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15205"/>
		<updated>2024-02-03T14:26:56Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Dynamic Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X is an advanced dynamic load management system whose purpose is to support the transfer of graphics and color palettes to the VRAM and CGRAM respectively. This system would replace Dynamic Z V3.7 which in turn is a replacement for DSX.&lt;br /&gt;
== Download ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
= Features =&lt;br /&gt;
*Load Poses Dynamically: Allows to load poses for Dynamic Sprites from any ASM code.&lt;br /&gt;
*Draw Poses: Allows to draw any pose that is registered in the system anywhere on the screen and from any ASM code. The way of drawing is totally optimized for each pose, basically all the poses that have similar characteristics, use the same graphic routine to optimize cycles and to make it as efficient as possible, besides diminishing considerably the amount of ROM used in graphic routines, since, 1 graphic routine can draw hundreds of different poses that belong to different Sprites.&lt;br /&gt;
*Load Graphics to VRAM.&lt;br /&gt;
*Load Color Palettes to the CGRAM.&lt;br /&gt;
*Automatic Palette Assignment: When a Sprite loads a palette, it can ask the system to assign a palette in an automated way, it will look for a free palette and it can be used by the Sprite, in case the palette is already loaded in the loaded CGRAM then it will give the Sprite that palette. The system informs if there are no palettes available, this way, you can avoid that the Sprite tries to work with wrong palettes.&lt;br /&gt;
*Color Palette Effects: You can edit the palettes that are loaded to change attributes such as Hue, Saturation and Brightness, you can weight them with a preset color or de-power certain RGB or HSL channels.&lt;br /&gt;
*Registration of Graphics and Palettes: The system allows you to insert graphics and palettes in the ROM, when you do so, the position in which they were saved in the ROM are available and you can also know the ID with which it was registered in the system, you can use that ID to dynamically load those graphics. Dynamic X will take care of deleting the graphics and palettes previously saved by the system and insert the new graphics and palettes in a free place in the ROM.&lt;br /&gt;
== Features that may have compatibility issues ==&lt;br /&gt;
*Custom Player Graphics: Dynamic X allows you to either change the player graphics using an EXGFX similar to GFX32 being limited to use the size and number of poses of the Vanilla game or simply disable completely the dynamic loading of player graphics, yoshi or podoboos to make your own dynamic routine for a custom player without limitations of size or number of poses. This feature allows you to change the graphics at any time, so you could use different players in different levels or in different areas of the same level.&lt;br /&gt;
*Player Custom Palettes: Dynamic X allows you to change the player&#039;s color palette freely.&lt;br /&gt;
*Player DMA optimizations: Dynamic X decreases considerably the cycles used by the NMI handler, since, the player graphics, yoshi and podoboos are only loaded in the VRAM when they are required, not always as it happens in the Vanilla game. This also leaves you some extra tiles in SP1 in levels that don&#039;t use yoshi or podoboos, even an extra tile in levels that don&#039;t use the layer.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
= Installation =&lt;br /&gt;
== General Steps ==&lt;br /&gt;
Before installing Dynamic X.&lt;br /&gt;
# The ROM must have SA-1 Pack installed.&lt;br /&gt;
# Put all files with &amp;quot;.drawinfo&amp;quot; extension in the &amp;quot;DrawInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.dynamicinfo&amp;quot; extension in the &amp;quot;DynamicInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.paleffect&amp;quot; extension in the &amp;quot;PaletteEffects&amp;quot; folder.&lt;br /&gt;
# Put all resource files such as GFXs and Color Palettes with &amp;quot;.bin&amp;quot; extension in the &amp;quot;DynamicResources&amp;quot; folder.&lt;br /&gt;
== Using the Tool Directly ==&lt;br /&gt;
You can install Dynamic X by opening the file &amp;quot;DynamicXTool.exe&amp;quot;, it will open a console telling you what to type at any given moment. It will start asking you for the ROM paths, Pixi folder, UberasmTool or GPS (these last 3 are optional) and then it will ask you for the features you want to install, put &amp;quot;y&amp;quot; or &amp;quot;yes&amp;quot; to enable each feature and &amp;quot;n&amp;quot; or &amp;quot;no&amp;quot; to disable that feature.&lt;br /&gt;
Warning: Features such as Player Features and Status Bar Optimization, may have incompatibilities with other resources, so you should be careful when installing them. Be careful which features you install.&lt;br /&gt;
&lt;br /&gt;
== Using the Tool From Console ==&lt;br /&gt;
You must call the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ROM will install with the default settings if you have never done a previous installation, if you have done a previous installation, then the settings used in that installation will be used.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
In case you want to change the settings manually you must open the settings.json file that will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must change the parameters according to the settings you want.&lt;br /&gt;
= Formats =&lt;br /&gt;
== Dynamic Info ==&lt;br /&gt;
Files with extension &amp;quot;.dynamicinfo&amp;quot; are used to insert pose graphics, palettes and other resources into the ROM. They also include the information necessary for the poses to be loaded correctly into the VRAM.&lt;br /&gt;
&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Below this label goes each graphics file used to load dynamic poses. Example: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Below this label goes each color palette file used for dynamic poses. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Resources&#039;&#039;&#039;: Below this label goes each extra file that is used as a resource and that you want to insert into the ROM. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Resources:&lt;br /&gt;
	Geno.bin&lt;br /&gt;
	GenoPal.bin&lt;br /&gt;
	FireGenoPal.bin&lt;br /&gt;
	GenoPalPlayer2.bin&lt;br /&gt;
	FireGenoPalPlayer2.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesChunksSizes&#039;&#039;&#039;: Below this label goes 2 lines for each pose, the first line is a label describing the pose and the second line is 2 values, each of these values indicates how many 8x8 tiles are used in each chunk, each dynamic pose has 2 chunks of data generally (except some exceptions that may require only 1 chunk), the top chunk and the bottom chunk. The top chunk is all the 8x8 tiles that are before the last 8 pixels high line, while the bottom chunk is the last line. In the following example you can see 3 images, the left one is how the assembled image should look like, the second one is how it would look like in the VRAM and the third one is how it would be saved in the binary file, it would also show how the poses sizes of that pose are, which in this case would be 8 tiles of the top chunk and 8 tiles of the bottom chunk:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: For poses whose number of 8x8 tiles is divisible by 32, you can use only the top chunk that has all the tiles and the bottom chunk would be 0. For Example if you have:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $10,$10&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can use:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $20,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is better because can use less DMA Transfers.&lt;br /&gt;
&lt;br /&gt;
== Draw Info ==&lt;br /&gt;
The files with extension &amp;quot;.drawinfo&amp;quot;, have the necessary information to draw poses, these poses can be dynamic or static poses. Dynamic X uses these files to generate optimized graphic routines for each pose, the tool detects if one of the tables is necessary or not, eliminates redundant data, pigeonholes each pose in a group that shares similar characteristics and then inserts a graphic routine for each group of poses that share similar characteristics.&lt;br /&gt;
The file format is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: If true it is dynamic, if false it is static, example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: It is a table that indicates which tiles each pose uses, in the case of the dynamic poses it must be considered that the tile of more superior to the left is the tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, this table contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; and the second line would be each one of the tiles used by the pose This table is optional and in case it is not, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the tiles of the pose. This table is optional and in case it is not present, it will use the value $00 for the tiles of the pose. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: It is a table that indicates the horizontal displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move horizontally each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped horizontally, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping. The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;YDisplacements&#039;&#039;&#039;: It is a table that indicates the vertical displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_YDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move vertically each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped vertically, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_YDispFlipY:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping. The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
YDisplacements:&lt;br /&gt;
Pose32x32_YDisp:&lt;br /&gt;
    db $00,$00,$10,$10&lt;br /&gt;
Pose32x32_YDispFlipY:&lt;br /&gt;
    db $10,$10,$00,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Sizes&#039;&#039;&#039;: Is a table indicating the size of each tile used, each value is &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for 8x8 tiles and &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for 16x16 tiles. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the size of each tile. This table is optional and in case it does not exist, it will use the value &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Sizes:&lt;br /&gt;
Pose32x32_Sizes:&lt;br /&gt;
    db $02,$02,$02,$02&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Properties&#039;&#039;&#039;: Is a table indicating the properties of each tile, the properties follow the format YXCCPPPT, where X is if the tile is flipped horizontally, Y is if the tile is flipped vertically, CC is the priority with respect to layer 1 and layer 2, where 00 is the lowest priority and 11 is the highest, CCC is the color palette used by the tile and T is 1 for using SP3/SP4 and 0 for SP1/SP2. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the property of each tile. This table is optional and in case it does not exist, it will use the value given in the &amp;lt;code&amp;gt;!PropParam&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Properties:&lt;br /&gt;
Pose32x32_Properties:&lt;br /&gt;
    db $20,$20,$20,$20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Palette Effect ==&lt;br /&gt;
The files with extension &amp;quot;.paleffect&amp;quot; are json files that are used for multiple color palette effects, both global and normal, these files can be created using the tool &amp;quot;Palette Effect Creator&amp;quot; that is included with Dynamic X.&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;Name&amp;quot;: ...,&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [...]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Name&#039;&#039;&#039;: This is the name of the color palette effect set. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Name&amp;quot;: &amp;quot;DecreaseSaturation&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Effects&#039;&#039;&#039;: It is a list with each of the color palette effects, these have 7 parameters, the first 3 are Channel1, Channel2 and Channel3 which are values between 0 and 31 that indicate the value of each channel, in the case of an RGB effect, Channel1 is R, Channel2 is G and channel3 is B, in the case of an HSL effect, Channel1 is H, Channel2 is S and Channel3 is L, then come 3 more values, the Ratio1, Ratio2 and Ratio3, each of these is a number between 0 and 31 indicating how much each Channel affects the colors of the color palette, where 0 is that it affects 0% and 31 is that it affects 100%, finally Channels is to indicate whether it is an RGB or HSL effect, 0 is RGB and 1 is HSL. The following example shows 2 HSL effects that decrease saturation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 30,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 31,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Palette Effect Creator ===&lt;br /&gt;
You can find the tool on the official Dynamic X website:&lt;br /&gt;
*[https://snestorage.com/index.php Palette Effect Creator]&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/Viabilidad_de_Bosses_de_Metal_Slug_en_SNES&amp;diff=15203</id>
		<title>es/Viabilidad de Bosses de Metal Slug en SNES</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/Viabilidad_de_Bosses_de_Metal_Slug_en_SNES&amp;diff=15203"/>
		<updated>2024-01-23T20:03:46Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Metal Slug 3 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Este articulo busca hacer una lista completa de cada boss de la saga Metal Slug y ver cuales son viables de hacer en SNES y que sacrificios habría que tomar para poder hacerlo viable.&lt;br /&gt;
&lt;br /&gt;
= Metal Slug =&lt;br /&gt;
== Tetsuyuki ==&lt;br /&gt;
== Hairbuster Riberts ==&lt;br /&gt;
== Allen O&#039;Neil ==&lt;br /&gt;
== Tani Oh ==&lt;br /&gt;
== Shoe &amp;amp; Karn ==&lt;br /&gt;
== Iron Nokana ==&lt;br /&gt;
== Hi-Do ==&lt;br /&gt;
&lt;br /&gt;
= Metal Slug 2/X =&lt;br /&gt;
== The Keesi II ==&lt;br /&gt;
== Aeshi Nero ==&lt;br /&gt;
== Dragon Nosuke ==&lt;br /&gt;
== Big Shiee ==&lt;br /&gt;
== Hozmi ==&lt;br /&gt;
== Allen O&#039;Neil ==&lt;br /&gt;
== Dai-Manji ==&lt;br /&gt;
== Rugname ==&lt;br /&gt;
&lt;br /&gt;
= Metal Slug 3 =&lt;br /&gt;
== Iron Nokana MK II ==&lt;br /&gt;
== The Keesi ==&lt;br /&gt;
== Twin Ohumein-Conga ==&lt;br /&gt;
== Huge Hermit ==&lt;br /&gt;
== Monoeyes ==&lt;br /&gt;
== Monoeye UFO ==&lt;br /&gt;
== Jupiter King ==&lt;br /&gt;
== Sol Dae Rokker ==&lt;br /&gt;
== Hairbuster Riberts ==&lt;br /&gt;
== Hi-Do ==&lt;br /&gt;
== Rugname ==&lt;br /&gt;
== Fake Rootmars ==&lt;br /&gt;
== Clone Incubator ==&lt;br /&gt;
== Rootmars ==&lt;br /&gt;
&lt;br /&gt;
= Metal Slug 4 =&lt;br /&gt;
= Metal Slug 5 =&lt;br /&gt;
= Metal Slug 6 =&lt;br /&gt;
= Metal Slug Advance =&lt;br /&gt;
= Metal Slug 7/XX =&lt;br /&gt;
&lt;br /&gt;
= Metal Slug Defense =&lt;br /&gt;
= Metal Slug Attack =&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/Viabilidad_de_Bosses_de_Metal_Slug_en_SNES&amp;diff=15202</id>
		<title>es/Viabilidad de Bosses de Metal Slug en SNES</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/Viabilidad_de_Bosses_de_Metal_Slug_en_SNES&amp;diff=15202"/>
		<updated>2024-01-23T19:59:45Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Metal Slug 7/XX */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Este articulo busca hacer una lista completa de cada boss de la saga Metal Slug y ver cuales son viables de hacer en SNES y que sacrificios habría que tomar para poder hacerlo viable.&lt;br /&gt;
&lt;br /&gt;
= Metal Slug =&lt;br /&gt;
== Tetsuyuki ==&lt;br /&gt;
== Hairbuster Riberts ==&lt;br /&gt;
== Allen O&#039;Neil ==&lt;br /&gt;
== Tani Oh ==&lt;br /&gt;
== Shoe &amp;amp; Karn ==&lt;br /&gt;
== Iron Nokana ==&lt;br /&gt;
== Hi-Do ==&lt;br /&gt;
&lt;br /&gt;
= Metal Slug 2/X =&lt;br /&gt;
== The Keesi II ==&lt;br /&gt;
== Aeshi Nero ==&lt;br /&gt;
== Dragon Nosuke ==&lt;br /&gt;
== Big Shiee ==&lt;br /&gt;
== Hozmi ==&lt;br /&gt;
== Allen O&#039;Neil ==&lt;br /&gt;
== Dai-Manji ==&lt;br /&gt;
== Rugname ==&lt;br /&gt;
&lt;br /&gt;
= Metal Slug 3 =&lt;br /&gt;
= Metal Slug 4 =&lt;br /&gt;
= Metal Slug 5 =&lt;br /&gt;
= Metal Slug 6 =&lt;br /&gt;
= Metal Slug Advance =&lt;br /&gt;
= Metal Slug 7/XX =&lt;br /&gt;
&lt;br /&gt;
= Metal Slug Defense =&lt;br /&gt;
= Metal Slug Attack =&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/Viabilidad_de_Bosses_de_Metal_Slug_en_SNES&amp;diff=15201</id>
		<title>es/Viabilidad de Bosses de Metal Slug en SNES</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/Viabilidad_de_Bosses_de_Metal_Slug_en_SNES&amp;diff=15201"/>
		<updated>2024-01-23T19:59:24Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Metal Slug 2/X */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Este articulo busca hacer una lista completa de cada boss de la saga Metal Slug y ver cuales son viables de hacer en SNES y que sacrificios habría que tomar para poder hacerlo viable.&lt;br /&gt;
&lt;br /&gt;
= Metal Slug =&lt;br /&gt;
== Tetsuyuki ==&lt;br /&gt;
== Hairbuster Riberts ==&lt;br /&gt;
== Allen O&#039;Neil ==&lt;br /&gt;
== Tani Oh ==&lt;br /&gt;
== Shoe &amp;amp; Karn ==&lt;br /&gt;
== Iron Nokana ==&lt;br /&gt;
== Hi-Do ==&lt;br /&gt;
&lt;br /&gt;
= Metal Slug 2/X =&lt;br /&gt;
== The Keesi II ==&lt;br /&gt;
== Aeshi Nero ==&lt;br /&gt;
== Dragon Nosuke ==&lt;br /&gt;
== Big Shiee ==&lt;br /&gt;
== Hozmi ==&lt;br /&gt;
== Allen O&#039;Neil ==&lt;br /&gt;
== Dai-Manji ==&lt;br /&gt;
== Rugname ==&lt;br /&gt;
&lt;br /&gt;
= Metal Slug 3 =&lt;br /&gt;
= Metal Slug 4 =&lt;br /&gt;
= Metal Slug 5 =&lt;br /&gt;
= Metal Slug 6 =&lt;br /&gt;
= Metal Slug 7/XX =&lt;br /&gt;
= Metal Slug Defense =&lt;br /&gt;
= Metal Slug Attack =&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/Viabilidad_de_Bosses_de_Metal_Slug_en_SNES&amp;diff=15200</id>
		<title>es/Viabilidad de Bosses de Metal Slug en SNES</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/Viabilidad_de_Bosses_de_Metal_Slug_en_SNES&amp;diff=15200"/>
		<updated>2024-01-23T19:58:01Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Metal Slug */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Este articulo busca hacer una lista completa de cada boss de la saga Metal Slug y ver cuales son viables de hacer en SNES y que sacrificios habría que tomar para poder hacerlo viable.&lt;br /&gt;
&lt;br /&gt;
= Metal Slug =&lt;br /&gt;
== Tetsuyuki ==&lt;br /&gt;
== Hairbuster Riberts ==&lt;br /&gt;
== Allen O&#039;Neil ==&lt;br /&gt;
== Tani Oh ==&lt;br /&gt;
== Shoe &amp;amp; Karn ==&lt;br /&gt;
== Iron Nokana ==&lt;br /&gt;
== Hi-Do ==&lt;br /&gt;
&lt;br /&gt;
= Metal Slug 2/X =&lt;br /&gt;
= Metal Slug 3 =&lt;br /&gt;
= Metal Slug 4 =&lt;br /&gt;
= Metal Slug 5 =&lt;br /&gt;
= Metal Slug 6 =&lt;br /&gt;
= Metal Slug 7/XX =&lt;br /&gt;
= Metal Slug Defense =&lt;br /&gt;
= Metal Slug Attack =&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/Viabilidad_de_Bosses_de_Metal_Slug_en_SNES&amp;diff=15199</id>
		<title>es/Viabilidad de Bosses de Metal Slug en SNES</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/Viabilidad_de_Bosses_de_Metal_Slug_en_SNES&amp;diff=15199"/>
		<updated>2024-01-23T19:56:02Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: Created page with &amp;quot;Este articulo busca hacer una lista completa de cada boss de la saga Metal Slug y ver cuales son viables de hacer en SNES y que sacrificios habría que tomar para poder hacerlo viable.  = Metal Slug = = Metal Slug 2/X = = Metal Slug 3 = = Metal Slug 4 = = Metal Slug 5 = = Metal Slug 6 = = Metal Slug 7/XX = = Metal Slug Defense = = Metal Slug Attack =&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Este articulo busca hacer una lista completa de cada boss de la saga Metal Slug y ver cuales son viables de hacer en SNES y que sacrificios habría que tomar para poder hacerlo viable.&lt;br /&gt;
&lt;br /&gt;
= Metal Slug =&lt;br /&gt;
= Metal Slug 2/X =&lt;br /&gt;
= Metal Slug 3 =&lt;br /&gt;
= Metal Slug 4 =&lt;br /&gt;
= Metal Slug 5 =&lt;br /&gt;
= Metal Slug 6 =&lt;br /&gt;
= Metal Slug 7/XX =&lt;br /&gt;
= Metal Slug Defense =&lt;br /&gt;
= Metal Slug Attack =&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/Metal_Slug_Bosses_Viability&amp;diff=15198</id>
		<title>es/Metal Slug Bosses Viability</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/Metal_Slug_Bosses_Viability&amp;diff=15198"/>
		<updated>2024-01-23T19:53:38Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: Created page with &amp;quot;{{Select Language|Viabilidad de Bosses de Metal Slug en SNES}}&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Viabilidad de Bosses de Metal Slug en SNES}}&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Metal_Slug_Bosses_Viability&amp;diff=15197</id>
		<title>Metal Slug Bosses Viability</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Metal_Slug_Bosses_Viability&amp;diff=15197"/>
		<updated>2024-01-23T19:53:12Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: Created page with &amp;quot;{{Select Language|Metal Slug Bosses Viability}}&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Metal Slug Bosses Viability}}&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/Dynamic_X&amp;diff=15127</id>
		<title>es/Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/Dynamic_X&amp;diff=15127"/>
		<updated>2024-01-20T00:44:00Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Dynamic Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X es un sistema avanzado de manejo de carga dinámica cuyo propósito es otorgar soporte a la transferencia de gráficos y paletas de colores a la VRAM y CGRAM respectivamente. Este sistema vendría a reemplazar al Dynamic Z V3.7 que a su ves es un reemplazo del DSX.&lt;br /&gt;
== Descarga ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
== Funcionalidades ==&lt;br /&gt;
* Cargar Poses Dinámicamente: Permite cargar poses para Sprites Dinámicos desde cualquier código ASM.&lt;br /&gt;
* Dibujar Poses: Permite dibujar cualquier pose que este registrada en el sistema en cualquier lugar de la pantalla y desde cualquier código ASM. La forma de dibujar esta totalmente optimizada para cada pose, básicamente todas las poses que tienen características similares, usan la misma rutina grafica para optimizar ciclos y que sea lo más eficiente posible, además de disminuir considerablemente la cantidad de ROM utilizada en rutinas graficas, ya que, 1 rutina grafica puede dibujar cientos de poses distintas que pertenecen a distintos Sprites.&lt;br /&gt;
* Cargar Gráficos a la VRAM.&lt;br /&gt;
* Cargar Paletas de Colores a la CGRAM.&lt;br /&gt;
* Asignación Automática de Paletas: Cuando un Sprite carga una paleta, puede pedir al sistema que le asigne una paleta de forma automatizada, este buscara una paleta libre y podrá ser usada por el Sprite, en caso que la paleta ya este cargada en la CGRAM cargada entonces le dará al Sprite esa paleta. El sistema informa si no hay paletas disponibles, de esta manera, se puede evitar que el Sprite intente funcionar con paletas erróneas.&lt;br /&gt;
* Efectos de Paletas de Colores: Se puede editar las paletas que están cargadas para que cambien atributos como el Hue (Tinte), la Saturación y el Brillo, se pueden ponderar con un color preestablecido o también quitarle potencia a ciertos canales RGB o HSL.&lt;br /&gt;
* Registro de Gráficos y Paletas: El sistema permite insertar gráficos y paletas en el ROM, al hacerlo quedan disponibles la posición en que fueron guardados en el ROM y además puedes saber el ID con que fue registrado en el sistema, puedes utilizar ese ID para cargar dinámicamente esos gráficos. Dynamic X se hará cargo de eliminar los gráficos y paletas guardados previamente por el sistema e insertar los nuevos gráficos y paletas en un lugar libre en la ROM.&lt;br /&gt;
=== Funcionalidades que pueden tener problemas de compatibilidad ===&lt;br /&gt;
* Gráficos Custom para el Player: Dynamic X permite tanto cambiar los gráficos del player usando un EXGFX similar al GFX32 estando limitado a que use el tamaño y la cantidad de poses del juego Vanilla o simplemente deshabilitar completamente la carga dinámica de gráficos del player, yoshi o podoboos para hacer tu propia rutina dinámica para un player custom sin limitaciones de tamaño o cantidad de poses. Esta funcionalidad permite cambiar los gráficos en cualquier momento, por lo que podrías usar distintos players en distintos niveles o en distintas zonas del mismo nivel.&lt;br /&gt;
* Paletas Custom para el Player: Dynamic X te permite cambiar la paleta de colores del player libremente.&lt;br /&gt;
* Optimizaciones del DMA del Player: Dynamic X disminuye considerablemente los ciclos utilizados por el NMI handler, ya que, los gráficos del player, yoshi y podoboos solo son cargados en la VRAM cuando son requeridos, no siempre como ocurre en el juego Vanilla. Esto además te deja algunos tiles extras en el SP1 en niveles que no utilicen a yoshi o podoboos, incluso un tile extra en niveles que no usen la capa.&lt;br /&gt;
&lt;br /&gt;
== Requisitos ==&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
&lt;br /&gt;
== Instalación ==&lt;br /&gt;
=== Pasos Generales ===&lt;br /&gt;
Antes de instalar el Dynamic X.&lt;br /&gt;
# El ROM debe tener instalado SA-1 Pack.&lt;br /&gt;
# Poner todos los archivos con extensión &amp;quot;.drawinfo&amp;quot; en la carpeta &amp;quot;DrawInfo&amp;quot;.&lt;br /&gt;
# Poner todos los archivos con extensión &amp;quot;.dynamicinfo&amp;quot; en la carpeta &amp;quot;DynamicInfo&amp;quot;.&lt;br /&gt;
# Poner todos los archivos con extension &amp;quot;.paleffect&amp;quot; en la carpeta &amp;quot;PaletteEffects&amp;quot;.&lt;br /&gt;
# Poner todos los archivos de recursos como GFXs y Paletas de colores que tienen extension &amp;quot;.bin&amp;quot; en la carpeta &amp;quot;DynamicResources&amp;quot;.&lt;br /&gt;
==== Usando el Tool Directamente ====&lt;br /&gt;
Puedes instalar el Dynamic X dándole abriendo el archivo &amp;quot;DynamicXTool.exe&amp;quot;, al hacerlo se te abrirá una consola diciéndote que escribir en cada momento. Iniciara preguntandote por los paths del ROM, carpeta de Pixi, UberasmTool o GPS (estos ultimos 3 son optativos) y luego te preguntara por los features que quieres instalar, pon &amp;quot;y&amp;quot; o &amp;quot;yes&amp;quot; para habilitar cada feature y &amp;quot;n&amp;quot; o &amp;quot;no para deshabilitar ese feature.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advertencia&#039;&#039;&#039;: Los features como Player Features y Status Bar Optimization, pueden tener incompatibilidades con otros recursos, así que debes tener cuidado al instalarlos. Tener cuidado con que features instalan.&lt;br /&gt;
&lt;br /&gt;
==== Usando el Tool Desde Consola ====&lt;br /&gt;
Debes llamar el comando:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
El ROM se instalara con los settings default si nunca se ha hecho una instalación previa, si se ha hecho una instalación previa, entonces se usaran los settings usados en esa instalación.&lt;br /&gt;
&lt;br /&gt;
===== Settings =====&lt;br /&gt;
En caso de querer cambiar los settings manualmente debes abrir el archivo settings.json que se vera así:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Debes cambiar los parámetros según los settings que desees.&lt;br /&gt;
&lt;br /&gt;
== Mejoras en Comparación a otros sistemas ==&lt;br /&gt;
=== Dynamic X VS DSX ===&lt;br /&gt;
* Dynamic X contiene muchos features que DSX no posee. El DSX solo posee soporte para sprites dinámicos. Por favor ver capitulo [https://sneslab.net/mw/index.php?title=es/Dynamic_X&amp;amp;action=edit&amp;amp;section=1 Funcionalidades].&lt;br /&gt;
* DSX permite máximo 4 sprites dinámicos de 32x32, 2 de 48x48 o 1 de 64x64. Dynamic X tiene menos limitaciones en el número de sprites, primero por que todos los sprites comparten poses, por lo tanto, si hay 2 sprites iguales es muy probable que puedas usar todos los que quieras en pantalla sin problemas, segundo puedes decirle al Dynamic X que espacio dinámico usar y dependiendo de ese espacio tienes más o menos limite para sprites dinámicos, de hecho, no existe un limite para sprites dinámicos como tal debido a que si un sprite no puede cargar una pose en la vram, usa la ultima pose que logro cargar, por lo tanto, en el peor de los casos el sprite quedaría con su pose congelada por un momento hasta que sea capaz de cargar una nueva pose.&lt;br /&gt;
* DSX requiere copiar una rutina a todos los sprites que usan su sistema, Dynamic X es solo llamar una rutina de la API, en 3 lineas de codigo puedes subir una pose a la VRAM y dibujar esa pose, eso hace al Dynamic X mucho más eficiente en ROM.&lt;br /&gt;
* DSX no tiene sistema de dibujado, el sprite debe tener su propia rutina gráfica, lo que no solo hace que cada pose dinámica sea solo utilizable dentro del contexto del sprite, sino que gasta mucha más ROM al tener que hacer esa rutina gráfica. Dynamic X por otro lado, permite cargar cualquier pose dinámica y dibujarla desde cualquier código ASM, lo que le da mucha más flexibilidad de uso y además al tener un sistema centralizado de dibujo, se ahorra mucho espacio en ROM.&lt;br /&gt;
* El DSX permite como máximo, cargar poses dinámicas de 64x64 (16 tiles de 16x16), Dynamic X no tiene un limite, si puedes optimizar el NMI handler podrías teóricamente hacer poses de hasta 96x96 (32~36 tiles de 16x16), aunque sin optimizaciones fuertes y solo desactivando las exanimations vanilla, podrías conseguir un sprite 80x80 (24~25 tiles de 16x16).&lt;br /&gt;
* Los gráficos del Dynamic X, son optimizados, esto significa que a pesar de no estar comprimidos con algoritmos como LZ, si usan la menor cantidad de tiles de 16x16 y 8x8 posibles, por lo tanto, esto permite utilizar sprites más grandes y optimizar las transferencias a la VRAM, lo que aumenta su capacidad de tener más poses dinámicas cargadas en la VRAM. El DSX por su parte, los gráficos no tienen ningún tipo de optimización y suelen malgastar mucho espacio con zonas en blanco.&lt;br /&gt;
* El DSX usa un buffer que luego es enviado a la VRAM, esto es un problema debido a que generar ese buffer es muy lento y requiere muchos ciclos, además el DSX debe generar este buffer en cada frame, por lo que un sprite dinámico hecho para DSX suele ser muy lento y utilizar muchos recursos, incluso utilizando SA-1 podrías tener problemas de slowdown si utilizas sprites dinámicos y algún efecto de hdma que sea complejo como un parallax o un wave. El Dynamic X no utiliza un buffer, si no que usa cola de transferencias que se carga directamente a la VRAM sin buffers intermedios, no solo eso, sino que cada pose es cargada solo cuando es necesario, por lo tanto, la carga no se hace en cada frame, sino cuando es necesario, además en ciertos sprites puedes sincronizar la animación para que todos usen exactamente la misma pose o una pose que ya esta cargada en la VRAM, esto reduce considerablemente el slowdown.&lt;br /&gt;
&lt;br /&gt;
=== Dynamic X VS Dynamic Z V3.7 ===&lt;br /&gt;
&lt;br /&gt;
== Formatos ==&lt;br /&gt;
=== Dynamic Info ===&lt;br /&gt;
Los archivos con extensión &amp;quot;.dynamicinfo&amp;quot; se utilizan para insertar gráficos de poses, paletas y otros recursos en el ROM. Además incluyen la información necesaria para que las poses sean cargadas correctamente en la VRAM.&lt;br /&gt;
&lt;br /&gt;
El formato de estos archivos es el siguiente:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Debajo de este label va cada archivo de gráficos utilizado para cargar poses dinámicas. Ejemplo: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Debajo de este label va cada archivo de paletas de colores utilizado para las poses dinámicas. Ejemplo: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Resources&#039;&#039;&#039;: Debajo de este label va cada archivo extra que se utilice como recurso y que se desee insertar en el ROM. Ejemplo: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Resources:&lt;br /&gt;
	Geno.bin&lt;br /&gt;
	GenoPal.bin&lt;br /&gt;
	FireGenoPal.bin&lt;br /&gt;
	GenoPalPlayer2.bin&lt;br /&gt;
	FireGenoPalPlayer2.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesSizes&#039;&#039;&#039;: Debajo de este archivo van 2 líneas por cada pose, la primera linea es un label que describe la pose y la segunda linea son 2 valores, cada uno de estos valores indica cuantos tiles de 8x8 se usan en cada chunk, cada pose dinámica tiene 2 chunks de data generalmente (excepto algunas excepciones que pueden requerir solo 1 chunk), el chunk de arriba y el chunk de abajo. El chunk de arriba son todos los tiles de 8x8 que están antes de la ultima linea de 8 pixeles de alto, mientras que el chunk de abajo es la ultima linea. En el siguiente ejemplo se pueden ver 3 imagenes, la de la izquierda es como deberia verse la imagen ensamblada, la segunda es como se veria en la VRAM y la tercera es como estaria guardado en el archivo binario, tambien mostraria como son los poses sizes de esa pose, que en este caso serian 8 tiles del chunk de arriba y 8 tiles del chunk de abajo:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nota: Para poses cuyo número de tiles de 8x8 sea divisible por 32, se puede usar solo el chunk de arriba que tiene todos los tiles y el chunk de abajo quedaria en 0.&lt;br /&gt;
&lt;br /&gt;
=== Draw Info ===&lt;br /&gt;
Los archivos con extensión &amp;quot;.drawinfo&amp;quot;, tienen la información necesaria para dibujar poses, estas poses pueden ser dinámicas o poses estáticas. El Dynamic X utiliza estos archivos para generar rutinas gráficas optimizadas para cada pose, el tool detecta si es necesaria o no una de las tablas, elimina data redundante o que no aporta, encasilla cada pose en un grupo que comparte características similares y luego inserta una rutina gráfica por cada grupo de poses que comparten características similares.&lt;br /&gt;
El formato del archivo es el siguiente:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: Si es true es dinámica, si es false es estatica, ejemplo:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: Es una tabla que indica que tiles utiliza cada pose, en el caso de las poses dinámicas debe considerarse que el tile de más arriba a la izquierda es el tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, esta tabla contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; y la segunda línea seria cada uno de los tiles utilizado por la pose. Esta tabla es optativa y en caso de que no este, utilizara el valor &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: Es una tabla que indica el desplazamiento horizontal de cada tile con respecto a la posición de la pose y contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code&amp;gt; y la segunda línea es un valor por cada tile de la pose indicando cuanto debe moverse horizontalmente cada tile con respecto a la posición de la pose, adicionalmente se pueden añadir 2 líneas más por cada pose para cuando la pose es volteada horizontalmente, el formato es el mismo de las 2 líneas anteriores solo que la primera línea es &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code&amp;gt;. Esta tabla es optativa y en caso de no existir, utilizara el valor &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32 y permitiendo volteo horizontal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;YDisplacements&#039;&#039;&#039;: Es una tabla que indica el desplazamiento vertical de cada tile con respecto a la posición de la pose y contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_YDisp:&amp;lt;/code&amp;gt; y la segunda línea es un valor por cada tile de la pose indicando cuanto debe moverse verticalmente cada tile con respecto a la posición de la pose, adicionalmente se pueden añadir 2 líneas más por cada pose para cuando la pose es volteada verticalmente, el formato es el mismo de las 2 líneas anteriores solo que la primera línea es &amp;lt;code&amp;gt;PoseName_YDispFlipY:&amp;lt;/code&amp;gt;. Esta tabla es optativa y en caso de no existir, utilizara el valor &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32 y permitiendo volteo vertical:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
YDisplacements:&lt;br /&gt;
Pose32x32_YDisp:&lt;br /&gt;
    db $00,$00,$10,$10&lt;br /&gt;
Pose32x32_YDispFlipY:&lt;br /&gt;
    db $10,$10,$00,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Sizes&#039;&#039;&#039;: Es una tabla que indica el tamaño de cada uno de los tiles que se utiliza, cada valor es &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; para tiles de 8x8 y &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; para tiles de 16x16. Contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; y la segunda línea es un valor por cada tile de la pose indicando el tamaño de cada tile. Esta tabla es optativa y en caso de no existir, utilizara el valor &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Sizes:&lt;br /&gt;
Pose32x32_Sizes:&lt;br /&gt;
    db $02,$02,$02,$02&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Properties&#039;&#039;&#039;: Es una tabla que indica las propiedades de cada tile, las propiedades siguen el formato YXCCPPPT, donde X es si el tile es volteado horizontalmente, Y es si el tile es volteado verticalmente, CC es la prioridad con respecto al layer 1 y layer 2, donde 00 es la prioridad más baja y 11 es la más alta, CCC es la paleta de colores usada por el tile y T es 1 para usar SP3/SP4 y 0 para SP1/SP2. Contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; y la segunda línea es un valor por cada tile de la pose indicando la propiedad de cada tile. Esta tabla es optativa y en caso de no existir, utilizara el valor que se entregue en el &amp;lt;code&amp;gt;!PropParam&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Properties:&lt;br /&gt;
Pose32x32_Properties:&lt;br /&gt;
    db $20,$20,$20,$20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Palette Effect ===&lt;br /&gt;
Los archivos con extensión &amp;quot;.paleffect&amp;quot; son archivos json que se utilizan para múltiples efectos de paletas de colores, tanto globales como normales, estos archivos pueden ser creados utilizando el tool &amp;quot;Palette Effect Creator&amp;quot; que es incluido al Dynamic X.&lt;br /&gt;
El formato de estos archivos es el siguiente:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;Name&amp;quot;: ...,&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [...]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Name&#039;&#039;&#039;: Es el nombre del conjunto de efectos de paletas de colores. Ejemplo:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Name&amp;quot;: &amp;quot;DecreaseSaturation&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Effects&#039;&#039;&#039;: Es una lista con cada uno de los efectos de paletas de colores, estos tienen 7 parámetros, los primeros 3 son Channel1, Channel2 y Channel3 que son valores entre 0 y 31 que indican el valor de cada canal, en el caso de un efecto RGB, el Channel1 es R, el Channel2 es G y el channel3 es B, en el caso de un efecto HSL, el Channel1 es H, el Channel2 es S y el Channel3 es L, luego vienen 3 valores más, el Ratio1, Ratio2 y Ratio3, cada uno de estos es un número entre 0 y 31 indicando cuanto afecta cada Channel a los colores de la paleta de colores, donde 0 es que afecta en un 0% y 31 es que afecta en un 100%, por ultimo Channels es para indicar si es un efecto RGB o HSL, 0 es RGB y 1 es HSL. El sguiente ejemplo muestra 2 efectos HSL que disminuyen la saturación:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 30,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 31,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Palette Effect Creator ===&lt;br /&gt;
Puedes encontrar el tool en el sitio web oficial de Dynamic X:&lt;br /&gt;
*[https://snestorage.com/index.php Palette Effect Creator]&lt;br /&gt;
&lt;br /&gt;
== Modo de Uso ==&lt;br /&gt;
=== Carga Dinámica de Poses ===&lt;br /&gt;
==== Cambiar Configuración de Espacio para Poses Dinámicas ====&lt;br /&gt;
&lt;br /&gt;
=== Dibujar Poses ===&lt;br /&gt;
=== Carga y Dibujo de Poses en Sprites ===&lt;br /&gt;
Los sprites (Sprites normales, clusters y extended) poseen rutinas especiales que se insertan en las Shared Routines de Pixi al momento de instalar el Dynamic X, estas rutinas simplifican considerablemente el trabajar con poses dinámicas y con el sistema de dibujo del Dinamic X.&lt;br /&gt;
==== Upload ====&lt;br /&gt;
La primera rutina es &#039;&#039;&#039;Upload&#039;&#039;&#039;, esta rutina carga en el espacio destinado para poses Dinámicas, la pose que deseas. Posee 2 versiones el &#039;&#039;&#039;Upload&#039;&#039;&#039; normal y el &#039;&#039;&#039;UploadWithoutPoseOffset&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Upload&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Versiones&#039;&#039;&#039;: %DXNormalUpload(), %DXClusterUpload(), %DXExtendedUpload().&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Input&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A&#039;&#039;&#039;: ID de la pose base (16 bits). Se puede usar el define autogenerado por Dynamic X que es &amp;lt;code&amp;gt;!DynamicPoseID&amp;lt;Nombre del Dynamic Info&amp;gt;000&amp;lt;/code&amp;gt;. Ejemplo: &amp;lt;code&amp;gt;!DynamicPoseIDDKCKlaptrap000&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;!PoseIndex,x&#039;&#039;&#039;: La pose dentro del contexto que se desea cargar. Se calcula la pose como &amp;lt;code&amp;gt;A + !PoseIndex,x&amp;lt;/code&amp;gt;. Por ejemplo si deseamos la pose 5 de Klaptrap en A se pondria &amp;lt;code&amp;gt;!DynamicPoseIDDKCKlaptrap000&amp;lt;/code&amp;gt; y en &amp;lt;code&amp;gt;!PoseIndex,x&amp;lt;/code&amp;gt; pondriamos el valor &amp;lt;code&amp;gt;$05&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Output&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Carry&#039;&#039;&#039;: Si despues de la rutina hay un Carry Set, puede significar 3 cosas:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
La pose fue cargada con éxito.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
La pose ya estaba cargada previamente y se esta reutilizando.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
La pose no fue cargada y no fue encontrada, pero en un ciclo anterior si se cargo una pose en la VRAM y se puede usar.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Si el Carry es un Carry Clear, la pose no pudo ser cargada y previamente no se cargo ninguna pose, en este caso lo recomendable seria despawnear el sprite, excepto si es un Boss o un sprite que debe ser persistente en el nivel. &lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;!LastPoseIndex,x&#039;&#039;&#039;: Tendrá el valor de la ultima pose que fue cargada a la VRAM. Al momento de dibujar o de hacer una rutina de interacción que tenga cajas de colisión dependientes de la pose, se debería utilizar esta tabla. Si es &amp;lt;code&amp;gt;$FF&amp;lt;/code&amp;gt; entonces nunca se ha cargado una pose previamente.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;!LastPoseHashIndex,x&#039;&#039;&#039;: Es de uso interno, pero básicamente contendrá el valor del ID que indexa la tabla hash de poses de la ultima pose que fue cargada. Si es &amp;lt;code&amp;gt;$FF&amp;lt;/code&amp;gt; entonces nunca se ha cargado una pose previamente.  Si es &amp;lt;code&amp;gt;$FF&amp;lt;/code&amp;gt; entonces nunca se ha cargado una pose previamente.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;!LastFlip,x&#039;&#039;&#039;: Es el valor de &amp;lt;code&amp;gt;!GlobalFlip,x XOR !LocalFlip,x&amp;lt;/code&amp;gt; que tenia la ultima pose que fue cargada. Al momento de dibujar o de hacer una rutina de interacción que tenga cajas de colisión dependientes de la pose, se debería utilizar esta tabla. Si es &amp;lt;code&amp;gt;$FF&amp;lt;/code&amp;gt; entonces nunca se ha cargado una pose previamente.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;$04&#039;&#039;&#039;: Tendra el valor &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; si el primer tile de la pose esta cargado en SP1 o SP2, o &amp;lt;code&amp;gt;$01&amp;lt;/code&amp;gt; si el primer tile de la pose fue cargado en SP3 o SP4.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;$08&#039;&#039;&#039;: Tiene el Offset del primer Tile que se cargo en la pose.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;UploadWithoutPoseOffset&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Versiones&#039;&#039;&#039;: %DXNormalUploadWithoutPoseOffset(), %DXClusterUploadWithoutPoseOffset(), %DXExtendedUploadWithoutPoseOffset().&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Input&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A&#039;&#039;&#039;: ID de la pose deseada (16 bits). Puedes utilizar los defines autogenerados por Dynamic X para la pose que inician con &amp;lt;code&amp;gt;!DynamicPoseID&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Outputs&#039;&#039;&#039;: Los mismos de &#039;&#039;&#039;Upload&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
==== Draw ====&lt;br /&gt;
La segunda rutina es &#039;&#039;&#039;Draw&#039;&#039;&#039;, esta rutina se encarga de dibujar una pose, puede recibir ciertos parámetros para cambiar las propiedades, la posición o la prioridad de la pose. Tiene 2 versiones distintas &#039;&#039;&#039;Draw&#039;&#039;&#039; y &#039;&#039;&#039;DrawWithOffset&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Draw&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Versiones&#039;&#039;&#039;: %DXNormalDraw(), %DXClusterDraw(), %DXExtendedDraw()&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Inputs&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DrawWithOffset&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Versiones&#039;&#039;&#039;: %DXNormalDrawWithOffset(), %DXClusterDrawWithOffset(), %DXExtendedDrawWithOffset()&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Carga de Gráficos ===&lt;br /&gt;
=== Carga de Paletas ===&lt;br /&gt;
=== Paletas de Sprites ===&lt;br /&gt;
==== Asignación de Paletas ====&lt;br /&gt;
===== Restringir Sobre escritura de Paletas =====&lt;br /&gt;
&lt;br /&gt;
=== Efectos de paletas ===&lt;br /&gt;
=== Cambiar Gráficos del Player usando un GFX similar al GFX32 ===&lt;br /&gt;
=== Cambiar Gráficos del Player ===&lt;br /&gt;
=== Cambiar Paleta del Player ===&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15126</id>
		<title>Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15126"/>
		<updated>2024-01-20T00:43:54Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Dynamic Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X is an advanced dynamic load management system whose purpose is to support the transfer of graphics and color palettes to the VRAM and CGRAM respectively. This system would replace Dynamic Z V3.7 which in turn is a replacement for DSX.&lt;br /&gt;
== Download ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
= Features =&lt;br /&gt;
*Load Poses Dynamically: Allows to load poses for Dynamic Sprites from any ASM code.&lt;br /&gt;
*Draw Poses: Allows to draw any pose that is registered in the system anywhere on the screen and from any ASM code. The way of drawing is totally optimized for each pose, basically all the poses that have similar characteristics, use the same graphic routine to optimize cycles and to make it as efficient as possible, besides diminishing considerably the amount of ROM used in graphic routines, since, 1 graphic routine can draw hundreds of different poses that belong to different Sprites.&lt;br /&gt;
*Load Graphics to VRAM.&lt;br /&gt;
*Load Color Palettes to the CGRAM.&lt;br /&gt;
*Automatic Palette Assignment: When a Sprite loads a palette, it can ask the system to assign a palette in an automated way, it will look for a free palette and it can be used by the Sprite, in case the palette is already loaded in the loaded CGRAM then it will give the Sprite that palette. The system informs if there are no palettes available, this way, you can avoid that the Sprite tries to work with wrong palettes.&lt;br /&gt;
*Color Palette Effects: You can edit the palettes that are loaded to change attributes such as Hue, Saturation and Brightness, you can weight them with a preset color or de-power certain RGB or HSL channels.&lt;br /&gt;
*Registration of Graphics and Palettes: The system allows you to insert graphics and palettes in the ROM, when you do so, the position in which they were saved in the ROM are available and you can also know the ID with which it was registered in the system, you can use that ID to dynamically load those graphics. Dynamic X will take care of deleting the graphics and palettes previously saved by the system and insert the new graphics and palettes in a free place in the ROM.&lt;br /&gt;
== Features that may have compatibility issues ==&lt;br /&gt;
*Custom Player Graphics: Dynamic X allows you to either change the player graphics using an EXGFX similar to GFX32 being limited to use the size and number of poses of the Vanilla game or simply disable completely the dynamic loading of player graphics, yoshi or podoboos to make your own dynamic routine for a custom player without limitations of size or number of poses. This feature allows you to change the graphics at any time, so you could use different players in different levels or in different areas of the same level.&lt;br /&gt;
*Player Custom Palettes: Dynamic X allows you to change the player&#039;s color palette freely.&lt;br /&gt;
*Player DMA optimizations: Dynamic X decreases considerably the cycles used by the NMI handler, since, the player graphics, yoshi and podoboos are only loaded in the VRAM when they are required, not always as it happens in the Vanilla game. This also leaves you some extra tiles in SP1 in levels that don&#039;t use yoshi or podoboos, even an extra tile in levels that don&#039;t use the layer.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
= Installation =&lt;br /&gt;
== General Steps ==&lt;br /&gt;
Before installing Dynamic X.&lt;br /&gt;
# The ROM must have SA-1 Pack installed.&lt;br /&gt;
# Put all files with &amp;quot;.drawinfo&amp;quot; extension in the &amp;quot;DrawInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.dynamicinfo&amp;quot; extension in the &amp;quot;DynamicInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.paleffect&amp;quot; extension in the &amp;quot;PaletteEffects&amp;quot; folder.&lt;br /&gt;
# Put all resource files such as GFXs and Color Palettes with &amp;quot;.bin&amp;quot; extension in the &amp;quot;DynamicResources&amp;quot; folder.&lt;br /&gt;
== Using the Tool Directly ==&lt;br /&gt;
You can install Dynamic X by opening the file &amp;quot;DynamicXTool.exe&amp;quot;, it will open a console telling you what to type at any given moment. It will start asking you for the ROM paths, Pixi folder, UberasmTool or GPS (these last 3 are optional) and then it will ask you for the features you want to install, put &amp;quot;y&amp;quot; or &amp;quot;yes&amp;quot; to enable each feature and &amp;quot;n&amp;quot; or &amp;quot;no&amp;quot; to disable that feature.&lt;br /&gt;
Warning: Features such as Player Features and Status Bar Optimization, may have incompatibilities with other resources, so you should be careful when installing them. Be careful which features you install.&lt;br /&gt;
&lt;br /&gt;
== Using the Tool From Console ==&lt;br /&gt;
You must call the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ROM will install with the default settings if you have never done a previous installation, if you have done a previous installation, then the settings used in that installation will be used.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
In case you want to change the settings manually you must open the settings.json file that will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must change the parameters according to the settings you want.&lt;br /&gt;
= Formats =&lt;br /&gt;
== Dynamic Info ==&lt;br /&gt;
Files with extension &amp;quot;.dynamicinfo&amp;quot; are used to insert pose graphics, palettes and other resources into the ROM. They also include the information necessary for the poses to be loaded correctly into the VRAM.&lt;br /&gt;
&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Below this label goes each graphics file used to load dynamic poses. Example: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Below this label goes each color palette file used for dynamic poses. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Resources&#039;&#039;&#039;: Below this label goes each extra file that is used as a resource and that you want to insert into the ROM. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Resources:&lt;br /&gt;
	Geno.bin&lt;br /&gt;
	GenoPal.bin&lt;br /&gt;
	FireGenoPal.bin&lt;br /&gt;
	GenoPalPlayer2.bin&lt;br /&gt;
	FireGenoPalPlayer2.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesChunksSizes&#039;&#039;&#039;: Below this label goes 2 lines for each pose, the first line is a label describing the pose and the second line is 2 values, each of these values indicates how many 8x8 tiles are used in each chunk, each dynamic pose has 2 chunks of data generally (except some exceptions that may require only 1 chunk), the top chunk and the bottom chunk. The top chunk is all the 8x8 tiles that are before the last 8 pixels high line, while the bottom chunk is the last line. In the following example you can see 3 images, the left one is how the assembled image should look like, the second one is how it would look like in the VRAM and the third one is how it would be saved in the binary file, it would also show how the poses sizes of that pose are, which in this case would be 8 tiles of the top chunk and 8 tiles of the bottom chunk:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: For poses whose number of 8x8 tiles is divisible by 32, you can use only the top chunk that has all the tiles and the bottom chunk would be 0.&lt;br /&gt;
&lt;br /&gt;
== Draw Info ==&lt;br /&gt;
The files with extension &amp;quot;.drawinfo&amp;quot;, have the necessary information to draw poses, these poses can be dynamic or static poses. Dynamic X uses these files to generate optimized graphic routines for each pose, the tool detects if one of the tables is necessary or not, eliminates redundant data, pigeonholes each pose in a group that shares similar characteristics and then inserts a graphic routine for each group of poses that share similar characteristics.&lt;br /&gt;
The file format is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: If true it is dynamic, if false it is static, example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: It is a table that indicates which tiles each pose uses, in the case of the dynamic poses it must be considered that the tile of more superior to the left is the tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, this table contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; and the second line would be each one of the tiles used by the pose This table is optional and in case it is not, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the tiles of the pose. This table is optional and in case it is not present, it will use the value $00 for the tiles of the pose. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: It is a table that indicates the horizontal displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move horizontally each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped horizontally, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping. The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;YDisplacements&#039;&#039;&#039;: It is a table that indicates the vertical displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_YDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move vertically each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped vertically, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_YDispFlipY:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping. The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
YDisplacements:&lt;br /&gt;
Pose32x32_YDisp:&lt;br /&gt;
    db $00,$00,$10,$10&lt;br /&gt;
Pose32x32_YDispFlipY:&lt;br /&gt;
    db $10,$10,$00,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Sizes&#039;&#039;&#039;: Is a table indicating the size of each tile used, each value is &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for 8x8 tiles and &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for 16x16 tiles. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the size of each tile. This table is optional and in case it does not exist, it will use the value &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Sizes:&lt;br /&gt;
Pose32x32_Sizes:&lt;br /&gt;
    db $02,$02,$02,$02&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Properties&#039;&#039;&#039;: Is a table indicating the properties of each tile, the properties follow the format YXCCPPPT, where X is if the tile is flipped horizontally, Y is if the tile is flipped vertically, CC is the priority with respect to layer 1 and layer 2, where 00 is the lowest priority and 11 is the highest, CCC is the color palette used by the tile and T is 1 for using SP3/SP4 and 0 for SP1/SP2. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the property of each tile. This table is optional and in case it does not exist, it will use the value given in the &amp;lt;code&amp;gt;!PropParam&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Properties:&lt;br /&gt;
Pose32x32_Properties:&lt;br /&gt;
    db $20,$20,$20,$20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Palette Effect ==&lt;br /&gt;
The files with extension &amp;quot;.paleffect&amp;quot; are json files that are used for multiple color palette effects, both global and normal, these files can be created using the tool &amp;quot;Palette Effect Creator&amp;quot; that is included with Dynamic X.&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;Name&amp;quot;: ...,&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [...]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Name&#039;&#039;&#039;: This is the name of the color palette effect set. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Name&amp;quot;: &amp;quot;DecreaseSaturation&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Effects&#039;&#039;&#039;: It is a list with each of the color palette effects, these have 7 parameters, the first 3 are Channel1, Channel2 and Channel3 which are values between 0 and 31 that indicate the value of each channel, in the case of an RGB effect, Channel1 is R, Channel2 is G and channel3 is B, in the case of an HSL effect, Channel1 is H, Channel2 is S and Channel3 is L, then come 3 more values, the Ratio1, Ratio2 and Ratio3, each of these is a number between 0 and 31 indicating how much each Channel affects the colors of the color palette, where 0 is that it affects 0% and 31 is that it affects 100%, finally Channels is to indicate whether it is an RGB or HSL effect, 0 is RGB and 1 is HSL. The following example shows 2 HSL effects that decrease saturation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 30,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 31,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Palette Effect Creator ===&lt;br /&gt;
You can find the tool on the official Dynamic X website:&lt;br /&gt;
*[https://snestorage.com/index.php Palette Effect Creator]&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15125</id>
		<title>Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15125"/>
		<updated>2024-01-20T00:43:07Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Dynamic Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X is an advanced dynamic load management system whose purpose is to support the transfer of graphics and color palettes to the VRAM and CGRAM respectively. This system would replace Dynamic Z V3.7 which in turn is a replacement for DSX.&lt;br /&gt;
== Download ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
= Features =&lt;br /&gt;
*Load Poses Dynamically: Allows to load poses for Dynamic Sprites from any ASM code.&lt;br /&gt;
*Draw Poses: Allows to draw any pose that is registered in the system anywhere on the screen and from any ASM code. The way of drawing is totally optimized for each pose, basically all the poses that have similar characteristics, use the same graphic routine to optimize cycles and to make it as efficient as possible, besides diminishing considerably the amount of ROM used in graphic routines, since, 1 graphic routine can draw hundreds of different poses that belong to different Sprites.&lt;br /&gt;
*Load Graphics to VRAM.&lt;br /&gt;
*Load Color Palettes to the CGRAM.&lt;br /&gt;
*Automatic Palette Assignment: When a Sprite loads a palette, it can ask the system to assign a palette in an automated way, it will look for a free palette and it can be used by the Sprite, in case the palette is already loaded in the loaded CGRAM then it will give the Sprite that palette. The system informs if there are no palettes available, this way, you can avoid that the Sprite tries to work with wrong palettes.&lt;br /&gt;
*Color Palette Effects: You can edit the palettes that are loaded to change attributes such as Hue, Saturation and Brightness, you can weight them with a preset color or de-power certain RGB or HSL channels.&lt;br /&gt;
*Registration of Graphics and Palettes: The system allows you to insert graphics and palettes in the ROM, when you do so, the position in which they were saved in the ROM are available and you can also know the ID with which it was registered in the system, you can use that ID to dynamically load those graphics. Dynamic X will take care of deleting the graphics and palettes previously saved by the system and insert the new graphics and palettes in a free place in the ROM.&lt;br /&gt;
== Features that may have compatibility issues ==&lt;br /&gt;
*Custom Player Graphics: Dynamic X allows you to either change the player graphics using an EXGFX similar to GFX32 being limited to use the size and number of poses of the Vanilla game or simply disable completely the dynamic loading of player graphics, yoshi or podoboos to make your own dynamic routine for a custom player without limitations of size or number of poses. This feature allows you to change the graphics at any time, so you could use different players in different levels or in different areas of the same level.&lt;br /&gt;
*Player Custom Palettes: Dynamic X allows you to change the player&#039;s color palette freely.&lt;br /&gt;
*Player DMA optimizations: Dynamic X decreases considerably the cycles used by the NMI handler, since, the player graphics, yoshi and podoboos are only loaded in the VRAM when they are required, not always as it happens in the Vanilla game. This also leaves you some extra tiles in SP1 in levels that don&#039;t use yoshi or podoboos, even an extra tile in levels that don&#039;t use the layer.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
= Installation =&lt;br /&gt;
== General Steps ==&lt;br /&gt;
Before installing Dynamic X.&lt;br /&gt;
# The ROM must have SA-1 Pack installed.&lt;br /&gt;
# Put all files with &amp;quot;.drawinfo&amp;quot; extension in the &amp;quot;DrawInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.dynamicinfo&amp;quot; extension in the &amp;quot;DynamicInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.paleffect&amp;quot; extension in the &amp;quot;PaletteEffects&amp;quot; folder.&lt;br /&gt;
# Put all resource files such as GFXs and Color Palettes with &amp;quot;.bin&amp;quot; extension in the &amp;quot;DynamicResources&amp;quot; folder.&lt;br /&gt;
== Using the Tool Directly ==&lt;br /&gt;
You can install Dynamic X by opening the file &amp;quot;DynamicXTool.exe&amp;quot;, it will open a console telling you what to type at any given moment. It will start asking you for the ROM paths, Pixi folder, UberasmTool or GPS (these last 3 are optional) and then it will ask you for the features you want to install, put &amp;quot;y&amp;quot; or &amp;quot;yes&amp;quot; to enable each feature and &amp;quot;n&amp;quot; or &amp;quot;no&amp;quot; to disable that feature.&lt;br /&gt;
Warning: Features such as Player Features and Status Bar Optimization, may have incompatibilities with other resources, so you should be careful when installing them. Be careful which features you install.&lt;br /&gt;
&lt;br /&gt;
== Using the Tool From Console ==&lt;br /&gt;
You must call the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ROM will install with the default settings if you have never done a previous installation, if you have done a previous installation, then the settings used in that installation will be used.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
In case you want to change the settings manually you must open the settings.json file that will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must change the parameters according to the settings you want.&lt;br /&gt;
= Formats =&lt;br /&gt;
== Dynamic Info ==&lt;br /&gt;
Files with extension &amp;quot;.dynamicinfo&amp;quot; are used to insert pose graphics, palettes and other resources into the ROM. They also include the information necessary for the poses to be loaded correctly into the VRAM.&lt;br /&gt;
&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Below this label goes each graphics file used to load dynamic poses. Example: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Below this label goes each color palette file used for dynamic poses. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Resources&#039;&#039;&#039;: Below this label goes each extra file that is used as a resource and that you want to insert into the ROM. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Resources:&lt;br /&gt;
    Geno.bin&lt;br /&gt;
    GenoPal.bin&lt;br /&gt;
    FireGenoPal.bin&lt;br /&gt;
    GenoPalPlayer2.bin&lt;br /&gt;
    FireGenoPalPlayer2.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesChunksSizes&#039;&#039;&#039;: Below this label goes 2 lines for each pose, the first line is a label describing the pose and the second line is 2 values, each of these values indicates how many 8x8 tiles are used in each chunk, each dynamic pose has 2 chunks of data generally (except some exceptions that may require only 1 chunk), the top chunk and the bottom chunk. The top chunk is all the 8x8 tiles that are before the last 8 pixels high line, while the bottom chunk is the last line. In the following example you can see 3 images, the left one is how the assembled image should look like, the second one is how it would look like in the VRAM and the third one is how it would be saved in the binary file, it would also show how the poses sizes of that pose are, which in this case would be 8 tiles of the top chunk and 8 tiles of the bottom chunk:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: For poses whose number of 8x8 tiles is divisible by 32, you can use only the top chunk that has all the tiles and the bottom chunk would be 0.&lt;br /&gt;
&lt;br /&gt;
== Draw Info ==&lt;br /&gt;
The files with extension &amp;quot;.drawinfo&amp;quot;, have the necessary information to draw poses, these poses can be dynamic or static poses. Dynamic X uses these files to generate optimized graphic routines for each pose, the tool detects if one of the tables is necessary or not, eliminates redundant data, pigeonholes each pose in a group that shares similar characteristics and then inserts a graphic routine for each group of poses that share similar characteristics.&lt;br /&gt;
The file format is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: If true it is dynamic, if false it is static, example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: It is a table that indicates which tiles each pose uses, in the case of the dynamic poses it must be considered that the tile of more superior to the left is the tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, this table contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; and the second line would be each one of the tiles used by the pose This table is optional and in case it is not, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the tiles of the pose. This table is optional and in case it is not present, it will use the value $00 for the tiles of the pose. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: It is a table that indicates the horizontal displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move horizontally each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped horizontally, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping. The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;YDisplacements&#039;&#039;&#039;: It is a table that indicates the vertical displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_YDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move vertically each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped vertically, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_YDispFlipY:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping. The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
YDisplacements:&lt;br /&gt;
Pose32x32_YDisp:&lt;br /&gt;
    db $00,$00,$10,$10&lt;br /&gt;
Pose32x32_YDispFlipY:&lt;br /&gt;
    db $10,$10,$00,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Sizes&#039;&#039;&#039;: Is a table indicating the size of each tile used, each value is &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for 8x8 tiles and &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for 16x16 tiles. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the size of each tile. This table is optional and in case it does not exist, it will use the value &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Sizes:&lt;br /&gt;
Pose32x32_Sizes:&lt;br /&gt;
    db $02,$02,$02,$02&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Properties&#039;&#039;&#039;: Is a table indicating the properties of each tile, the properties follow the format YXCCPPPT, where X is if the tile is flipped horizontally, Y is if the tile is flipped vertically, CC is the priority with respect to layer 1 and layer 2, where 00 is the lowest priority and 11 is the highest, CCC is the color palette used by the tile and T is 1 for using SP3/SP4 and 0 for SP1/SP2. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the property of each tile. This table is optional and in case it does not exist, it will use the value given in the &amp;lt;code&amp;gt;!PropParam&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Properties:&lt;br /&gt;
Pose32x32_Properties:&lt;br /&gt;
    db $20,$20,$20,$20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Palette Effect ==&lt;br /&gt;
The files with extension &amp;quot;.paleffect&amp;quot; are json files that are used for multiple color palette effects, both global and normal, these files can be created using the tool &amp;quot;Palette Effect Creator&amp;quot; that is included with Dynamic X.&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;Name&amp;quot;: ...,&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [...]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Name&#039;&#039;&#039;: This is the name of the color palette effect set. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Name&amp;quot;: &amp;quot;DecreaseSaturation&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Effects&#039;&#039;&#039;: It is a list with each of the color palette effects, these have 7 parameters, the first 3 are Channel1, Channel2 and Channel3 which are values between 0 and 31 that indicate the value of each channel, in the case of an RGB effect, Channel1 is R, Channel2 is G and channel3 is B, in the case of an HSL effect, Channel1 is H, Channel2 is S and Channel3 is L, then come 3 more values, the Ratio1, Ratio2 and Ratio3, each of these is a number between 0 and 31 indicating how much each Channel affects the colors of the color palette, where 0 is that it affects 0% and 31 is that it affects 100%, finally Channels is to indicate whether it is an RGB or HSL effect, 0 is RGB and 1 is HSL. The following example shows 2 HSL effects that decrease saturation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 30,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 31,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Palette Effect Creator ===&lt;br /&gt;
You can find the tool on the official Dynamic X website:&lt;br /&gt;
*[https://snestorage.com/index.php Palette Effect Creator]&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15124</id>
		<title>Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15124"/>
		<updated>2024-01-20T00:41:10Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Dynamic Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X is an advanced dynamic load management system whose purpose is to support the transfer of graphics and color palettes to the VRAM and CGRAM respectively. This system would replace Dynamic Z V3.7 which in turn is a replacement for DSX.&lt;br /&gt;
== Download ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
= Features =&lt;br /&gt;
*Load Poses Dynamically: Allows to load poses for Dynamic Sprites from any ASM code.&lt;br /&gt;
*Draw Poses: Allows to draw any pose that is registered in the system anywhere on the screen and from any ASM code. The way of drawing is totally optimized for each pose, basically all the poses that have similar characteristics, use the same graphic routine to optimize cycles and to make it as efficient as possible, besides diminishing considerably the amount of ROM used in graphic routines, since, 1 graphic routine can draw hundreds of different poses that belong to different Sprites.&lt;br /&gt;
*Load Graphics to VRAM.&lt;br /&gt;
*Load Color Palettes to the CGRAM.&lt;br /&gt;
*Automatic Palette Assignment: When a Sprite loads a palette, it can ask the system to assign a palette in an automated way, it will look for a free palette and it can be used by the Sprite, in case the palette is already loaded in the loaded CGRAM then it will give the Sprite that palette. The system informs if there are no palettes available, this way, you can avoid that the Sprite tries to work with wrong palettes.&lt;br /&gt;
*Color Palette Effects: You can edit the palettes that are loaded to change attributes such as Hue, Saturation and Brightness, you can weight them with a preset color or de-power certain RGB or HSL channels.&lt;br /&gt;
*Registration of Graphics and Palettes: The system allows you to insert graphics and palettes in the ROM, when you do so, the position in which they were saved in the ROM are available and you can also know the ID with which it was registered in the system, you can use that ID to dynamically load those graphics. Dynamic X will take care of deleting the graphics and palettes previously saved by the system and insert the new graphics and palettes in a free place in the ROM.&lt;br /&gt;
== Features that may have compatibility issues ==&lt;br /&gt;
*Custom Player Graphics: Dynamic X allows you to either change the player graphics using an EXGFX similar to GFX32 being limited to use the size and number of poses of the Vanilla game or simply disable completely the dynamic loading of player graphics, yoshi or podoboos to make your own dynamic routine for a custom player without limitations of size or number of poses. This feature allows you to change the graphics at any time, so you could use different players in different levels or in different areas of the same level.&lt;br /&gt;
*Player Custom Palettes: Dynamic X allows you to change the player&#039;s color palette freely.&lt;br /&gt;
*Player DMA optimizations: Dynamic X decreases considerably the cycles used by the NMI handler, since, the player graphics, yoshi and podoboos are only loaded in the VRAM when they are required, not always as it happens in the Vanilla game. This also leaves you some extra tiles in SP1 in levels that don&#039;t use yoshi or podoboos, even an extra tile in levels that don&#039;t use the layer.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
= Installation =&lt;br /&gt;
== General Steps ==&lt;br /&gt;
Before installing Dynamic X.&lt;br /&gt;
# The ROM must have SA-1 Pack installed.&lt;br /&gt;
# Put all files with &amp;quot;.drawinfo&amp;quot; extension in the &amp;quot;DrawInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.dynamicinfo&amp;quot; extension in the &amp;quot;DynamicInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.paleffect&amp;quot; extension in the &amp;quot;PaletteEffects&amp;quot; folder.&lt;br /&gt;
# Put all resource files such as GFXs and Color Palettes with &amp;quot;.bin&amp;quot; extension in the &amp;quot;DynamicResources&amp;quot; folder.&lt;br /&gt;
== Using the Tool Directly ==&lt;br /&gt;
You can install Dynamic X by opening the file &amp;quot;DynamicXTool.exe&amp;quot;, it will open a console telling you what to type at any given moment. It will start asking you for the ROM paths, Pixi folder, UberasmTool or GPS (these last 3 are optional) and then it will ask you for the features you want to install, put &amp;quot;y&amp;quot; or &amp;quot;yes&amp;quot; to enable each feature and &amp;quot;n&amp;quot; or &amp;quot;no&amp;quot; to disable that feature.&lt;br /&gt;
Warning: Features such as Player Features and Status Bar Optimization, may have incompatibilities with other resources, so you should be careful when installing them. Be careful which features you install.&lt;br /&gt;
&lt;br /&gt;
== Using the Tool From Console ==&lt;br /&gt;
You must call the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ROM will install with the default settings if you have never done a previous installation, if you have done a previous installation, then the settings used in that installation will be used.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
In case you want to change the settings manually you must open the settings.json file that will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must change the parameters according to the settings you want.&lt;br /&gt;
= Formats =&lt;br /&gt;
== Dynamic Info ==&lt;br /&gt;
Files with extension &amp;quot;.dynamicinfo&amp;quot; are used to insert pose graphics, palettes and other resources into the ROM. They also include the information necessary for the poses to be loaded correctly into the VRAM.&lt;br /&gt;
&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Below this label goes each graphics file used to load dynamic poses. Example: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Below this label goes each color palette file used for dynamic poses. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesChunksSizes&#039;&#039;&#039;: Below this label goes 2 lines for each pose, the first line is a label describing the pose and the second line is 2 values, each of these values indicates how many 8x8 tiles are used in each chunk, each dynamic pose has 2 chunks of data generally (except some exceptions that may require only 1 chunk), the top chunk and the bottom chunk. The top chunk is all the 8x8 tiles that are before the last 8 pixels high line, while the bottom chunk is the last line. In the following example you can see 3 images, the left one is how the assembled image should look like, the second one is how it would look like in the VRAM and the third one is how it would be saved in the binary file, it would also show how the poses sizes of that pose are, which in this case would be 8 tiles of the top chunk and 8 tiles of the bottom chunk:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: For poses whose number of 8x8 tiles is divisible by 32, you can use only the top chunk that has all the tiles and the bottom chunk would be 0.&lt;br /&gt;
&lt;br /&gt;
== Draw Info ==&lt;br /&gt;
The files with extension &amp;quot;.drawinfo&amp;quot;, have the necessary information to draw poses, these poses can be dynamic or static poses. Dynamic X uses these files to generate optimized graphic routines for each pose, the tool detects if one of the tables is necessary or not, eliminates redundant data, pigeonholes each pose in a group that shares similar characteristics and then inserts a graphic routine for each group of poses that share similar characteristics.&lt;br /&gt;
The file format is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: If true it is dynamic, if false it is static, example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: It is a table that indicates which tiles each pose uses, in the case of the dynamic poses it must be considered that the tile of more superior to the left is the tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, this table contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; and the second line would be each one of the tiles used by the pose This table is optional and in case it is not, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the tiles of the pose. This table is optional and in case it is not present, it will use the value $00 for the tiles of the pose. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: It is a table that indicates the horizontal displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move horizontally each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped horizontally, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping. The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;YDisplacements&#039;&#039;&#039;: It is a table that indicates the vertical displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_YDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move vertically each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped vertically, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_YDispFlipY:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping. The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
YDisplacements:&lt;br /&gt;
Pose32x32_YDisp:&lt;br /&gt;
    db $00,$00,$10,$10&lt;br /&gt;
Pose32x32_YDispFlipY:&lt;br /&gt;
    db $10,$10,$00,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Sizes&#039;&#039;&#039;: Is a table indicating the size of each tile used, each value is &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for 8x8 tiles and &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for 16x16 tiles. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the size of each tile. This table is optional and in case it does not exist, it will use the value &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Sizes:&lt;br /&gt;
Pose32x32_Sizes:&lt;br /&gt;
    db $02,$02,$02,$02&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Properties&#039;&#039;&#039;: Is a table indicating the properties of each tile, the properties follow the format YXCCPPPT, where X is if the tile is flipped horizontally, Y is if the tile is flipped vertically, CC is the priority with respect to layer 1 and layer 2, where 00 is the lowest priority and 11 is the highest, CCC is the color palette used by the tile and T is 1 for using SP3/SP4 and 0 for SP1/SP2. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the property of each tile. This table is optional and in case it does not exist, it will use the value given in the &amp;lt;code&amp;gt;!PropParam&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Properties:&lt;br /&gt;
Pose32x32_Properties:&lt;br /&gt;
    db $20,$20,$20,$20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Palette Effect ==&lt;br /&gt;
The files with extension &amp;quot;.paleffect&amp;quot; are json files that are used for multiple color palette effects, both global and normal, these files can be created using the tool &amp;quot;Palette Effect Creator&amp;quot; that is included with Dynamic X.&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;Name&amp;quot;: ...,&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [...]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Name&#039;&#039;&#039;: This is the name of the color palette effect set. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Name&amp;quot;: &amp;quot;DecreaseSaturation&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Effects&#039;&#039;&#039;: It is a list with each of the color palette effects, these have 7 parameters, the first 3 are Channel1, Channel2 and Channel3 which are values between 0 and 31 that indicate the value of each channel, in the case of an RGB effect, Channel1 is R, Channel2 is G and channel3 is B, in the case of an HSL effect, Channel1 is H, Channel2 is S and Channel3 is L, then come 3 more values, the Ratio1, Ratio2 and Ratio3, each of these is a number between 0 and 31 indicating how much each Channel affects the colors of the color palette, where 0 is that it affects 0% and 31 is that it affects 100%, finally Channels is to indicate whether it is an RGB or HSL effect, 0 is RGB and 1 is HSL. The following example shows 2 HSL effects that decrease saturation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 30,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 31,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Palette Effect Creator ===&lt;br /&gt;
You can find the tool on the official Dynamic X website:&lt;br /&gt;
*[https://snestorage.com/index.php Palette Effect Creator]&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15123</id>
		<title>Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15123"/>
		<updated>2024-01-20T00:40:49Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Dynamic Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X is an advanced dynamic load management system whose purpose is to support the transfer of graphics and color palettes to the VRAM and CGRAM respectively. This system would replace Dynamic Z V3.7 which in turn is a replacement for DSX.&lt;br /&gt;
== Download ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
= Features =&lt;br /&gt;
*Load Poses Dynamically: Allows to load poses for Dynamic Sprites from any ASM code.&lt;br /&gt;
*Draw Poses: Allows to draw any pose that is registered in the system anywhere on the screen and from any ASM code. The way of drawing is totally optimized for each pose, basically all the poses that have similar characteristics, use the same graphic routine to optimize cycles and to make it as efficient as possible, besides diminishing considerably the amount of ROM used in graphic routines, since, 1 graphic routine can draw hundreds of different poses that belong to different Sprites.&lt;br /&gt;
*Load Graphics to VRAM.&lt;br /&gt;
*Load Color Palettes to the CGRAM.&lt;br /&gt;
*Automatic Palette Assignment: When a Sprite loads a palette, it can ask the system to assign a palette in an automated way, it will look for a free palette and it can be used by the Sprite, in case the palette is already loaded in the loaded CGRAM then it will give the Sprite that palette. The system informs if there are no palettes available, this way, you can avoid that the Sprite tries to work with wrong palettes.&lt;br /&gt;
*Color Palette Effects: You can edit the palettes that are loaded to change attributes such as Hue, Saturation and Brightness, you can weight them with a preset color or de-power certain RGB or HSL channels.&lt;br /&gt;
*Registration of Graphics and Palettes: The system allows you to insert graphics and palettes in the ROM, when you do so, the position in which they were saved in the ROM are available and you can also know the ID with which it was registered in the system, you can use that ID to dynamically load those graphics. Dynamic X will take care of deleting the graphics and palettes previously saved by the system and insert the new graphics and palettes in a free place in the ROM.&lt;br /&gt;
== Features that may have compatibility issues ==&lt;br /&gt;
*Custom Player Graphics: Dynamic X allows you to either change the player graphics using an EXGFX similar to GFX32 being limited to use the size and number of poses of the Vanilla game or simply disable completely the dynamic loading of player graphics, yoshi or podoboos to make your own dynamic routine for a custom player without limitations of size or number of poses. This feature allows you to change the graphics at any time, so you could use different players in different levels or in different areas of the same level.&lt;br /&gt;
*Player Custom Palettes: Dynamic X allows you to change the player&#039;s color palette freely.&lt;br /&gt;
*Player DMA optimizations: Dynamic X decreases considerably the cycles used by the NMI handler, since, the player graphics, yoshi and podoboos are only loaded in the VRAM when they are required, not always as it happens in the Vanilla game. This also leaves you some extra tiles in SP1 in levels that don&#039;t use yoshi or podoboos, even an extra tile in levels that don&#039;t use the layer.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
= Installation =&lt;br /&gt;
== General Steps ==&lt;br /&gt;
Before installing Dynamic X.&lt;br /&gt;
# The ROM must have SA-1 Pack installed.&lt;br /&gt;
# Put all files with &amp;quot;.drawinfo&amp;quot; extension in the &amp;quot;DrawInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.dynamicinfo&amp;quot; extension in the &amp;quot;DynamicInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.paleffect&amp;quot; extension in the &amp;quot;PaletteEffects&amp;quot; folder.&lt;br /&gt;
# Put all resource files such as GFXs and Color Palettes with &amp;quot;.bin&amp;quot; extension in the &amp;quot;DynamicResources&amp;quot; folder.&lt;br /&gt;
== Using the Tool Directly ==&lt;br /&gt;
You can install Dynamic X by opening the file &amp;quot;DynamicXTool.exe&amp;quot;, it will open a console telling you what to type at any given moment. It will start asking you for the ROM paths, Pixi folder, UberasmTool or GPS (these last 3 are optional) and then it will ask you for the features you want to install, put &amp;quot;y&amp;quot; or &amp;quot;yes&amp;quot; to enable each feature and &amp;quot;n&amp;quot; or &amp;quot;no&amp;quot; to disable that feature.&lt;br /&gt;
Warning: Features such as Player Features and Status Bar Optimization, may have incompatibilities with other resources, so you should be careful when installing them. Be careful which features you install.&lt;br /&gt;
&lt;br /&gt;
== Using the Tool From Console ==&lt;br /&gt;
You must call the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ROM will install with the default settings if you have never done a previous installation, if you have done a previous installation, then the settings used in that installation will be used.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
In case you want to change the settings manually you must open the settings.json file that will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must change the parameters according to the settings you want.&lt;br /&gt;
= Formats =&lt;br /&gt;
== Dynamic Info ==&lt;br /&gt;
Files with extension &amp;quot;.dynamicinfo&amp;quot; are used to insert pose graphics, palettes and other resources into the ROM. They also include the information necessary for the poses to be loaded correctly into the VRAM.&lt;br /&gt;
&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Below this label goes each graphics file used to load dynamic poses. Example: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Below this label goes each color palette file used for dynamic poses. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesChunksSizes&#039;&#039;&#039;: Below this file goes 2 lines for each pose, the first line is a label describing the pose and the second line is 2 values, each of these values indicates how many 8x8 tiles are used in each chunk, each dynamic pose has 2 chunks of data generally (except some exceptions that may require only 1 chunk), the top chunk and the bottom chunk. The top chunk is all the 8x8 tiles that are before the last 8 pixels high line, while the bottom chunk is the last line. In the following example you can see 3 images, the left one is how the assembled image should look like, the second one is how it would look like in the VRAM and the third one is how it would be saved in the binary file, it would also show how the poses sizes of that pose are, which in this case would be 8 tiles of the top chunk and 8 tiles of the bottom chunk:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: For poses whose number of 8x8 tiles is divisible by 32, you can use only the top chunk that has all the tiles and the bottom chunk would be 0.&lt;br /&gt;
&lt;br /&gt;
== Draw Info ==&lt;br /&gt;
The files with extension &amp;quot;.drawinfo&amp;quot;, have the necessary information to draw poses, these poses can be dynamic or static poses. Dynamic X uses these files to generate optimized graphic routines for each pose, the tool detects if one of the tables is necessary or not, eliminates redundant data, pigeonholes each pose in a group that shares similar characteristics and then inserts a graphic routine for each group of poses that share similar characteristics.&lt;br /&gt;
The file format is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: If true it is dynamic, if false it is static, example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: It is a table that indicates which tiles each pose uses, in the case of the dynamic poses it must be considered that the tile of more superior to the left is the tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, this table contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; and the second line would be each one of the tiles used by the pose This table is optional and in case it is not, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the tiles of the pose. This table is optional and in case it is not present, it will use the value $00 for the tiles of the pose. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: It is a table that indicates the horizontal displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move horizontally each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped horizontally, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping. The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;YDisplacements&#039;&#039;&#039;: It is a table that indicates the vertical displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_YDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move vertically each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped vertically, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_YDispFlipY:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping. The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
YDisplacements:&lt;br /&gt;
Pose32x32_YDisp:&lt;br /&gt;
    db $00,$00,$10,$10&lt;br /&gt;
Pose32x32_YDispFlipY:&lt;br /&gt;
    db $10,$10,$00,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Sizes&#039;&#039;&#039;: Is a table indicating the size of each tile used, each value is &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for 8x8 tiles and &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for 16x16 tiles. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the size of each tile. This table is optional and in case it does not exist, it will use the value &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Sizes:&lt;br /&gt;
Pose32x32_Sizes:&lt;br /&gt;
    db $02,$02,$02,$02&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Properties&#039;&#039;&#039;: Is a table indicating the properties of each tile, the properties follow the format YXCCPPPT, where X is if the tile is flipped horizontally, Y is if the tile is flipped vertically, CC is the priority with respect to layer 1 and layer 2, where 00 is the lowest priority and 11 is the highest, CCC is the color palette used by the tile and T is 1 for using SP3/SP4 and 0 for SP1/SP2. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the property of each tile. This table is optional and in case it does not exist, it will use the value given in the &amp;lt;code&amp;gt;!PropParam&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Properties:&lt;br /&gt;
Pose32x32_Properties:&lt;br /&gt;
    db $20,$20,$20,$20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Palette Effect ==&lt;br /&gt;
The files with extension &amp;quot;.paleffect&amp;quot; are json files that are used for multiple color palette effects, both global and normal, these files can be created using the tool &amp;quot;Palette Effect Creator&amp;quot; that is included with Dynamic X.&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;Name&amp;quot;: ...,&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [...]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Name&#039;&#039;&#039;: This is the name of the color palette effect set. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Name&amp;quot;: &amp;quot;DecreaseSaturation&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Effects&#039;&#039;&#039;: It is a list with each of the color palette effects, these have 7 parameters, the first 3 are Channel1, Channel2 and Channel3 which are values between 0 and 31 that indicate the value of each channel, in the case of an RGB effect, Channel1 is R, Channel2 is G and channel3 is B, in the case of an HSL effect, Channel1 is H, Channel2 is S and Channel3 is L, then come 3 more values, the Ratio1, Ratio2 and Ratio3, each of these is a number between 0 and 31 indicating how much each Channel affects the colors of the color palette, where 0 is that it affects 0% and 31 is that it affects 100%, finally Channels is to indicate whether it is an RGB or HSL effect, 0 is RGB and 1 is HSL. The following example shows 2 HSL effects that decrease saturation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 30,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 31,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Palette Effect Creator ===&lt;br /&gt;
You can find the tool on the official Dynamic X website:&lt;br /&gt;
*[https://snestorage.com/index.php Palette Effect Creator]&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15122</id>
		<title>Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15122"/>
		<updated>2024-01-20T00:38:12Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Draw Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X is an advanced dynamic load management system whose purpose is to support the transfer of graphics and color palettes to the VRAM and CGRAM respectively. This system would replace Dynamic Z V3.7 which in turn is a replacement for DSX.&lt;br /&gt;
== Download ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
= Features =&lt;br /&gt;
*Load Poses Dynamically: Allows to load poses for Dynamic Sprites from any ASM code.&lt;br /&gt;
*Draw Poses: Allows to draw any pose that is registered in the system anywhere on the screen and from any ASM code. The way of drawing is totally optimized for each pose, basically all the poses that have similar characteristics, use the same graphic routine to optimize cycles and to make it as efficient as possible, besides diminishing considerably the amount of ROM used in graphic routines, since, 1 graphic routine can draw hundreds of different poses that belong to different Sprites.&lt;br /&gt;
*Load Graphics to VRAM.&lt;br /&gt;
*Load Color Palettes to the CGRAM.&lt;br /&gt;
*Automatic Palette Assignment: When a Sprite loads a palette, it can ask the system to assign a palette in an automated way, it will look for a free palette and it can be used by the Sprite, in case the palette is already loaded in the loaded CGRAM then it will give the Sprite that palette. The system informs if there are no palettes available, this way, you can avoid that the Sprite tries to work with wrong palettes.&lt;br /&gt;
*Color Palette Effects: You can edit the palettes that are loaded to change attributes such as Hue, Saturation and Brightness, you can weight them with a preset color or de-power certain RGB or HSL channels.&lt;br /&gt;
*Registration of Graphics and Palettes: The system allows you to insert graphics and palettes in the ROM, when you do so, the position in which they were saved in the ROM are available and you can also know the ID with which it was registered in the system, you can use that ID to dynamically load those graphics. Dynamic X will take care of deleting the graphics and palettes previously saved by the system and insert the new graphics and palettes in a free place in the ROM.&lt;br /&gt;
== Features that may have compatibility issues ==&lt;br /&gt;
*Custom Player Graphics: Dynamic X allows you to either change the player graphics using an EXGFX similar to GFX32 being limited to use the size and number of poses of the Vanilla game or simply disable completely the dynamic loading of player graphics, yoshi or podoboos to make your own dynamic routine for a custom player without limitations of size or number of poses. This feature allows you to change the graphics at any time, so you could use different players in different levels or in different areas of the same level.&lt;br /&gt;
*Player Custom Palettes: Dynamic X allows you to change the player&#039;s color palette freely.&lt;br /&gt;
*Player DMA optimizations: Dynamic X decreases considerably the cycles used by the NMI handler, since, the player graphics, yoshi and podoboos are only loaded in the VRAM when they are required, not always as it happens in the Vanilla game. This also leaves you some extra tiles in SP1 in levels that don&#039;t use yoshi or podoboos, even an extra tile in levels that don&#039;t use the layer.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
= Installation =&lt;br /&gt;
== General Steps ==&lt;br /&gt;
Before installing Dynamic X.&lt;br /&gt;
# The ROM must have SA-1 Pack installed.&lt;br /&gt;
# Put all files with &amp;quot;.drawinfo&amp;quot; extension in the &amp;quot;DrawInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.dynamicinfo&amp;quot; extension in the &amp;quot;DynamicInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.paleffect&amp;quot; extension in the &amp;quot;PaletteEffects&amp;quot; folder.&lt;br /&gt;
# Put all resource files such as GFXs and Color Palettes with &amp;quot;.bin&amp;quot; extension in the &amp;quot;DynamicResources&amp;quot; folder.&lt;br /&gt;
== Using the Tool Directly ==&lt;br /&gt;
You can install Dynamic X by opening the file &amp;quot;DynamicXTool.exe&amp;quot;, it will open a console telling you what to type at any given moment. It will start asking you for the ROM paths, Pixi folder, UberasmTool or GPS (these last 3 are optional) and then it will ask you for the features you want to install, put &amp;quot;y&amp;quot; or &amp;quot;yes&amp;quot; to enable each feature and &amp;quot;n&amp;quot; or &amp;quot;no&amp;quot; to disable that feature.&lt;br /&gt;
Warning: Features such as Player Features and Status Bar Optimization, may have incompatibilities with other resources, so you should be careful when installing them. Be careful which features you install.&lt;br /&gt;
&lt;br /&gt;
== Using the Tool From Console ==&lt;br /&gt;
You must call the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ROM will install with the default settings if you have never done a previous installation, if you have done a previous installation, then the settings used in that installation will be used.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
In case you want to change the settings manually you must open the settings.json file that will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must change the parameters according to the settings you want.&lt;br /&gt;
= Formats =&lt;br /&gt;
== Dynamic Info ==&lt;br /&gt;
Files with extension &amp;quot;.dynamicinfo&amp;quot; are used to insert pose graphics, palettes and other resources into the ROM. They also include the information necessary for the poses to be loaded correctly into the VRAM.&lt;br /&gt;
&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Below this label goes each graphics file used to load dynamic poses. Example: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Below this label goes each color palette file used for dynamic poses. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesSizes&#039;&#039;&#039;&#039;: Below this file goes 2 lines for each pose, the first line is a label describing the pose and the second line is 2 values, each of these values indicates how many 8x8 tiles are used in each chunk, each dynamic pose has 2 chunks of data generally (except some exceptions that may require only 1 chunk), the top chunk and the bottom chunk. The top chunk is all the 8x8 tiles that are before the last 8 pixels high line, while the bottom chunk is the last line. In the following example you can see 3 images, the left one is how the assembled image should look like, the second one is how it would look like in the VRAM and the third one is how it would be saved in the binary file, it would also show how the poses sizes of that pose are, which in this case would be 8 tiles of the top chunk and 8 tiles of the bottom chunk:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: For poses whose number of 8x8 tiles is divisible by 32, you can use only the top chunk that has all the tiles and the bottom chunk would be 0.&lt;br /&gt;
&lt;br /&gt;
== Draw Info ==&lt;br /&gt;
The files with extension &amp;quot;.drawinfo&amp;quot;, have the necessary information to draw poses, these poses can be dynamic or static poses. Dynamic X uses these files to generate optimized graphic routines for each pose, the tool detects if one of the tables is necessary or not, eliminates redundant data, pigeonholes each pose in a group that shares similar characteristics and then inserts a graphic routine for each group of poses that share similar characteristics.&lt;br /&gt;
The file format is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: If true it is dynamic, if false it is static, example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: It is a table that indicates which tiles each pose uses, in the case of the dynamic poses it must be considered that the tile of more superior to the left is the tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, this table contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; and the second line would be each one of the tiles used by the pose This table is optional and in case it is not, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the tiles of the pose. This table is optional and in case it is not present, it will use the value $00 for the tiles of the pose. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: It is a table that indicates the horizontal displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move horizontally each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped horizontally, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping. The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;YDisplacements&#039;&#039;&#039;: It is a table that indicates the vertical displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_YDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move vertically each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped vertically, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_YDispFlipY:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping. The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
YDisplacements:&lt;br /&gt;
Pose32x32_YDisp:&lt;br /&gt;
    db $00,$00,$10,$10&lt;br /&gt;
Pose32x32_YDispFlipY:&lt;br /&gt;
    db $10,$10,$00,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Sizes&#039;&#039;&#039;: Is a table indicating the size of each tile used, each value is &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for 8x8 tiles and &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for 16x16 tiles. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the size of each tile. This table is optional and in case it does not exist, it will use the value &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Sizes:&lt;br /&gt;
Pose32x32_Sizes:&lt;br /&gt;
    db $02,$02,$02,$02&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Properties&#039;&#039;&#039;: Is a table indicating the properties of each tile, the properties follow the format YXCCPPPT, where X is if the tile is flipped horizontally, Y is if the tile is flipped vertically, CC is the priority with respect to layer 1 and layer 2, where 00 is the lowest priority and 11 is the highest, CCC is the color palette used by the tile and T is 1 for using SP3/SP4 and 0 for SP1/SP2. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the property of each tile. This table is optional and in case it does not exist, it will use the value given in the &amp;lt;code&amp;gt;!PropParam&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Properties:&lt;br /&gt;
Pose32x32_Properties:&lt;br /&gt;
    db $20,$20,$20,$20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Palette Effect ==&lt;br /&gt;
The files with extension &amp;quot;.paleffect&amp;quot; are json files that are used for multiple color palette effects, both global and normal, these files can be created using the tool &amp;quot;Palette Effect Creator&amp;quot; that is included with Dynamic X.&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;Name&amp;quot;: ...,&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [...]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Name&#039;&#039;&#039;: This is the name of the color palette effect set. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Name&amp;quot;: &amp;quot;DecreaseSaturation&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Effects&#039;&#039;&#039;: It is a list with each of the color palette effects, these have 7 parameters, the first 3 are Channel1, Channel2 and Channel3 which are values between 0 and 31 that indicate the value of each channel, in the case of an RGB effect, Channel1 is R, Channel2 is G and channel3 is B, in the case of an HSL effect, Channel1 is H, Channel2 is S and Channel3 is L, then come 3 more values, the Ratio1, Ratio2 and Ratio3, each of these is a number between 0 and 31 indicating how much each Channel affects the colors of the color palette, where 0 is that it affects 0% and 31 is that it affects 100%, finally Channels is to indicate whether it is an RGB or HSL effect, 0 is RGB and 1 is HSL. The following example shows 2 HSL effects that decrease saturation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 30,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 31,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Palette Effect Creator ===&lt;br /&gt;
You can find the tool on the official Dynamic X website:&lt;br /&gt;
*[https://snestorage.com/index.php Palette Effect Creator]&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15121</id>
		<title>Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15121"/>
		<updated>2024-01-20T00:37:52Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Draw Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X is an advanced dynamic load management system whose purpose is to support the transfer of graphics and color palettes to the VRAM and CGRAM respectively. This system would replace Dynamic Z V3.7 which in turn is a replacement for DSX.&lt;br /&gt;
== Download ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
= Features =&lt;br /&gt;
*Load Poses Dynamically: Allows to load poses for Dynamic Sprites from any ASM code.&lt;br /&gt;
*Draw Poses: Allows to draw any pose that is registered in the system anywhere on the screen and from any ASM code. The way of drawing is totally optimized for each pose, basically all the poses that have similar characteristics, use the same graphic routine to optimize cycles and to make it as efficient as possible, besides diminishing considerably the amount of ROM used in graphic routines, since, 1 graphic routine can draw hundreds of different poses that belong to different Sprites.&lt;br /&gt;
*Load Graphics to VRAM.&lt;br /&gt;
*Load Color Palettes to the CGRAM.&lt;br /&gt;
*Automatic Palette Assignment: When a Sprite loads a palette, it can ask the system to assign a palette in an automated way, it will look for a free palette and it can be used by the Sprite, in case the palette is already loaded in the loaded CGRAM then it will give the Sprite that palette. The system informs if there are no palettes available, this way, you can avoid that the Sprite tries to work with wrong palettes.&lt;br /&gt;
*Color Palette Effects: You can edit the palettes that are loaded to change attributes such as Hue, Saturation and Brightness, you can weight them with a preset color or de-power certain RGB or HSL channels.&lt;br /&gt;
*Registration of Graphics and Palettes: The system allows you to insert graphics and palettes in the ROM, when you do so, the position in which they were saved in the ROM are available and you can also know the ID with which it was registered in the system, you can use that ID to dynamically load those graphics. Dynamic X will take care of deleting the graphics and palettes previously saved by the system and insert the new graphics and palettes in a free place in the ROM.&lt;br /&gt;
== Features that may have compatibility issues ==&lt;br /&gt;
*Custom Player Graphics: Dynamic X allows you to either change the player graphics using an EXGFX similar to GFX32 being limited to use the size and number of poses of the Vanilla game or simply disable completely the dynamic loading of player graphics, yoshi or podoboos to make your own dynamic routine for a custom player without limitations of size or number of poses. This feature allows you to change the graphics at any time, so you could use different players in different levels or in different areas of the same level.&lt;br /&gt;
*Player Custom Palettes: Dynamic X allows you to change the player&#039;s color palette freely.&lt;br /&gt;
*Player DMA optimizations: Dynamic X decreases considerably the cycles used by the NMI handler, since, the player graphics, yoshi and podoboos are only loaded in the VRAM when they are required, not always as it happens in the Vanilla game. This also leaves you some extra tiles in SP1 in levels that don&#039;t use yoshi or podoboos, even an extra tile in levels that don&#039;t use the layer.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
= Installation =&lt;br /&gt;
== General Steps ==&lt;br /&gt;
Before installing Dynamic X.&lt;br /&gt;
# The ROM must have SA-1 Pack installed.&lt;br /&gt;
# Put all files with &amp;quot;.drawinfo&amp;quot; extension in the &amp;quot;DrawInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.dynamicinfo&amp;quot; extension in the &amp;quot;DynamicInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.paleffect&amp;quot; extension in the &amp;quot;PaletteEffects&amp;quot; folder.&lt;br /&gt;
# Put all resource files such as GFXs and Color Palettes with &amp;quot;.bin&amp;quot; extension in the &amp;quot;DynamicResources&amp;quot; folder.&lt;br /&gt;
== Using the Tool Directly ==&lt;br /&gt;
You can install Dynamic X by opening the file &amp;quot;DynamicXTool.exe&amp;quot;, it will open a console telling you what to type at any given moment. It will start asking you for the ROM paths, Pixi folder, UberasmTool or GPS (these last 3 are optional) and then it will ask you for the features you want to install, put &amp;quot;y&amp;quot; or &amp;quot;yes&amp;quot; to enable each feature and &amp;quot;n&amp;quot; or &amp;quot;no&amp;quot; to disable that feature.&lt;br /&gt;
Warning: Features such as Player Features and Status Bar Optimization, may have incompatibilities with other resources, so you should be careful when installing them. Be careful which features you install.&lt;br /&gt;
&lt;br /&gt;
== Using the Tool From Console ==&lt;br /&gt;
You must call the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ROM will install with the default settings if you have never done a previous installation, if you have done a previous installation, then the settings used in that installation will be used.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
In case you want to change the settings manually you must open the settings.json file that will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must change the parameters according to the settings you want.&lt;br /&gt;
= Formats =&lt;br /&gt;
== Dynamic Info ==&lt;br /&gt;
Files with extension &amp;quot;.dynamicinfo&amp;quot; are used to insert pose graphics, palettes and other resources into the ROM. They also include the information necessary for the poses to be loaded correctly into the VRAM.&lt;br /&gt;
&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Below this label goes each graphics file used to load dynamic poses. Example: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Below this label goes each color palette file used for dynamic poses. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesSizes&#039;&#039;&#039;&#039;: Below this file goes 2 lines for each pose, the first line is a label describing the pose and the second line is 2 values, each of these values indicates how many 8x8 tiles are used in each chunk, each dynamic pose has 2 chunks of data generally (except some exceptions that may require only 1 chunk), the top chunk and the bottom chunk. The top chunk is all the 8x8 tiles that are before the last 8 pixels high line, while the bottom chunk is the last line. In the following example you can see 3 images, the left one is how the assembled image should look like, the second one is how it would look like in the VRAM and the third one is how it would be saved in the binary file, it would also show how the poses sizes of that pose are, which in this case would be 8 tiles of the top chunk and 8 tiles of the bottom chunk:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: For poses whose number of 8x8 tiles is divisible by 32, you can use only the top chunk that has all the tiles and the bottom chunk would be 0.&lt;br /&gt;
&lt;br /&gt;
== Draw Info ==&lt;br /&gt;
The files with extension &amp;quot;.drawinfo&amp;quot;, have the necessary information to draw poses, these poses can be dynamic or static poses. Dynamic X uses these files to generate optimized graphic routines for each pose, the tool detects if one of the tables is necessary or not, eliminates redundant data, pigeonholes each pose in a group that shares similar characteristics and then inserts a graphic routine for each group of poses that share similar characteristics.&lt;br /&gt;
The file format is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: If true it is dynamic, if false it is static, example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: It is a table that indicates which tiles each pose uses, in the case of the dynamic poses it must be considered that the tile of more superior to the left is the tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, this table contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; and the second line would be each one of the tiles used by the pose This table is optional and in case it is not, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the tiles of the pose.This table is optional and in case it is not present, it will use the value $00 for the tiles of the pose. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: It is a table that indicates the horizontal displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move horizontally each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped horizontally, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping. The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;YDisplacements&#039;&#039;&#039;: It is a table that indicates the vertical displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_YDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move vertically each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped vertically, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_YDispFlipY:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping. The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
YDisplacements:&lt;br /&gt;
Pose32x32_YDisp:&lt;br /&gt;
    db $00,$00,$10,$10&lt;br /&gt;
Pose32x32_YDispFlipY:&lt;br /&gt;
    db $10,$10,$00,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Sizes&#039;&#039;&#039;: Is a table indicating the size of each tile used, each value is &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for 8x8 tiles and &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for 16x16 tiles. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the size of each tile. This table is optional and in case it does not exist, it will use the value &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Sizes:&lt;br /&gt;
Pose32x32_Sizes:&lt;br /&gt;
    db $02,$02,$02,$02&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Properties&#039;&#039;&#039;: Is a table indicating the properties of each tile, the properties follow the format YXCCPPPT, where X is if the tile is flipped horizontally, Y is if the tile is flipped vertically, CC is the priority with respect to layer 1 and layer 2, where 00 is the lowest priority and 11 is the highest, CCC is the color palette used by the tile and T is 1 for using SP3/SP4 and 0 for SP1/SP2. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the property of each tile. This table is optional and in case it does not exist, it will use the value given in the &amp;lt;code&amp;gt;!PropParam&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Properties:&lt;br /&gt;
Pose32x32_Properties:&lt;br /&gt;
    db $20,$20,$20,$20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Palette Effect ==&lt;br /&gt;
The files with extension &amp;quot;.paleffect&amp;quot; are json files that are used for multiple color palette effects, both global and normal, these files can be created using the tool &amp;quot;Palette Effect Creator&amp;quot; that is included with Dynamic X.&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;Name&amp;quot;: ...,&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [...]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Name&#039;&#039;&#039;: This is the name of the color palette effect set. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Name&amp;quot;: &amp;quot;DecreaseSaturation&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Effects&#039;&#039;&#039;: It is a list with each of the color palette effects, these have 7 parameters, the first 3 are Channel1, Channel2 and Channel3 which are values between 0 and 31 that indicate the value of each channel, in the case of an RGB effect, Channel1 is R, Channel2 is G and channel3 is B, in the case of an HSL effect, Channel1 is H, Channel2 is S and Channel3 is L, then come 3 more values, the Ratio1, Ratio2 and Ratio3, each of these is a number between 0 and 31 indicating how much each Channel affects the colors of the color palette, where 0 is that it affects 0% and 31 is that it affects 100%, finally Channels is to indicate whether it is an RGB or HSL effect, 0 is RGB and 1 is HSL. The following example shows 2 HSL effects that decrease saturation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 30,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 31,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Palette Effect Creator ===&lt;br /&gt;
You can find the tool on the official Dynamic X website:&lt;br /&gt;
*[https://snestorage.com/index.php Palette Effect Creator]&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15120</id>
		<title>Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15120"/>
		<updated>2024-01-20T00:36:53Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Palette Effect */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X is an advanced dynamic load management system whose purpose is to support the transfer of graphics and color palettes to the VRAM and CGRAM respectively. This system would replace Dynamic Z V3.7 which in turn is a replacement for DSX.&lt;br /&gt;
== Download ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
= Features =&lt;br /&gt;
*Load Poses Dynamically: Allows to load poses for Dynamic Sprites from any ASM code.&lt;br /&gt;
*Draw Poses: Allows to draw any pose that is registered in the system anywhere on the screen and from any ASM code. The way of drawing is totally optimized for each pose, basically all the poses that have similar characteristics, use the same graphic routine to optimize cycles and to make it as efficient as possible, besides diminishing considerably the amount of ROM used in graphic routines, since, 1 graphic routine can draw hundreds of different poses that belong to different Sprites.&lt;br /&gt;
*Load Graphics to VRAM.&lt;br /&gt;
*Load Color Palettes to the CGRAM.&lt;br /&gt;
*Automatic Palette Assignment: When a Sprite loads a palette, it can ask the system to assign a palette in an automated way, it will look for a free palette and it can be used by the Sprite, in case the palette is already loaded in the loaded CGRAM then it will give the Sprite that palette. The system informs if there are no palettes available, this way, you can avoid that the Sprite tries to work with wrong palettes.&lt;br /&gt;
*Color Palette Effects: You can edit the palettes that are loaded to change attributes such as Hue, Saturation and Brightness, you can weight them with a preset color or de-power certain RGB or HSL channels.&lt;br /&gt;
*Registration of Graphics and Palettes: The system allows you to insert graphics and palettes in the ROM, when you do so, the position in which they were saved in the ROM are available and you can also know the ID with which it was registered in the system, you can use that ID to dynamically load those graphics. Dynamic X will take care of deleting the graphics and palettes previously saved by the system and insert the new graphics and palettes in a free place in the ROM.&lt;br /&gt;
== Features that may have compatibility issues ==&lt;br /&gt;
*Custom Player Graphics: Dynamic X allows you to either change the player graphics using an EXGFX similar to GFX32 being limited to use the size and number of poses of the Vanilla game or simply disable completely the dynamic loading of player graphics, yoshi or podoboos to make your own dynamic routine for a custom player without limitations of size or number of poses. This feature allows you to change the graphics at any time, so you could use different players in different levels or in different areas of the same level.&lt;br /&gt;
*Player Custom Palettes: Dynamic X allows you to change the player&#039;s color palette freely.&lt;br /&gt;
*Player DMA optimizations: Dynamic X decreases considerably the cycles used by the NMI handler, since, the player graphics, yoshi and podoboos are only loaded in the VRAM when they are required, not always as it happens in the Vanilla game. This also leaves you some extra tiles in SP1 in levels that don&#039;t use yoshi or podoboos, even an extra tile in levels that don&#039;t use the layer.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
= Installation =&lt;br /&gt;
== General Steps ==&lt;br /&gt;
Before installing Dynamic X.&lt;br /&gt;
# The ROM must have SA-1 Pack installed.&lt;br /&gt;
# Put all files with &amp;quot;.drawinfo&amp;quot; extension in the &amp;quot;DrawInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.dynamicinfo&amp;quot; extension in the &amp;quot;DynamicInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.paleffect&amp;quot; extension in the &amp;quot;PaletteEffects&amp;quot; folder.&lt;br /&gt;
# Put all resource files such as GFXs and Color Palettes with &amp;quot;.bin&amp;quot; extension in the &amp;quot;DynamicResources&amp;quot; folder.&lt;br /&gt;
== Using the Tool Directly ==&lt;br /&gt;
You can install Dynamic X by opening the file &amp;quot;DynamicXTool.exe&amp;quot;, it will open a console telling you what to type at any given moment. It will start asking you for the ROM paths, Pixi folder, UberasmTool or GPS (these last 3 are optional) and then it will ask you for the features you want to install, put &amp;quot;y&amp;quot; or &amp;quot;yes&amp;quot; to enable each feature and &amp;quot;n&amp;quot; or &amp;quot;no&amp;quot; to disable that feature.&lt;br /&gt;
Warning: Features such as Player Features and Status Bar Optimization, may have incompatibilities with other resources, so you should be careful when installing them. Be careful which features you install.&lt;br /&gt;
&lt;br /&gt;
== Using the Tool From Console ==&lt;br /&gt;
You must call the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ROM will install with the default settings if you have never done a previous installation, if you have done a previous installation, then the settings used in that installation will be used.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
In case you want to change the settings manually you must open the settings.json file that will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must change the parameters according to the settings you want.&lt;br /&gt;
= Formats =&lt;br /&gt;
== Dynamic Info ==&lt;br /&gt;
Files with extension &amp;quot;.dynamicinfo&amp;quot; are used to insert pose graphics, palettes and other resources into the ROM. They also include the information necessary for the poses to be loaded correctly into the VRAM.&lt;br /&gt;
&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Below this label goes each graphics file used to load dynamic poses. Example: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Below this label goes each color palette file used for dynamic poses. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesSizes&#039;&#039;&#039;&#039;: Below this file goes 2 lines for each pose, the first line is a label describing the pose and the second line is 2 values, each of these values indicates how many 8x8 tiles are used in each chunk, each dynamic pose has 2 chunks of data generally (except some exceptions that may require only 1 chunk), the top chunk and the bottom chunk. The top chunk is all the 8x8 tiles that are before the last 8 pixels high line, while the bottom chunk is the last line. In the following example you can see 3 images, the left one is how the assembled image should look like, the second one is how it would look like in the VRAM and the third one is how it would be saved in the binary file, it would also show how the poses sizes of that pose are, which in this case would be 8 tiles of the top chunk and 8 tiles of the bottom chunk:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: For poses whose number of 8x8 tiles is divisible by 32, you can use only the top chunk that has all the tiles and the bottom chunk would be 0.&lt;br /&gt;
&lt;br /&gt;
== Draw Info ==&lt;br /&gt;
The files with extension &amp;quot;.drawinfo&amp;quot;, have the necessary information to draw poses, these poses can be dynamic or static poses. Dynamic X uses these files to generate optimized graphic routines for each pose, the tool detects if one of the tables is necessary or not, eliminates redundant data, pigeonholes each pose in a group that shares similar characteristics and then inserts a graphic routine for each group of poses that share similar characteristics.&lt;br /&gt;
The file format is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: If true it is dynamic, if false it is static, example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: It is a table that indicates which tiles each pose uses, in the case of the dynamic poses it must be considered that the tile of more superior to the left is the tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, this table contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; and the second line would be each one of the tiles used by the pose This table is optional and in case it is not, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the tiles of the pose.This table is optional and in case it is not present, it will use the value $00 for the tiles of the pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: It is a table that indicates the horizontal displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move horizontally each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped horizontally, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping. The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;YDisplacements&#039;&#039;&#039;: It is a table that indicates the vertical displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_YDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move vertically each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped vertically, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_YDispFlipY:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping. The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
YDisplacements:&lt;br /&gt;
Pose32x32_YDisp:&lt;br /&gt;
    db $00,$00,$10,$10&lt;br /&gt;
Pose32x32_YDispFlipY:&lt;br /&gt;
    db $10,$10,$00,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Sizes&#039;&#039;&#039;: Is a table indicating the size of each tile used, each value is &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for 8x8 tiles and &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for 16x16 tiles. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the size of each tile. This table is optional and in case it does not exist, it will use the value &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Sizes:&lt;br /&gt;
Pose32x32_Sizes:&lt;br /&gt;
    db $02,$02,$02,$02&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Properties&#039;&#039;&#039;: Is a table indicating the properties of each tile, the properties follow the format YXCCPPPT, where X is if the tile is flipped horizontally, Y is if the tile is flipped vertically, CC is the priority with respect to layer 1 and layer 2, where 00 is the lowest priority and 11 is the highest, CCC is the color palette used by the tile and T is 1 for using SP3/SP4 and 0 for SP1/SP2. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the property of each tile. This table is optional and in case it does not exist, it will use the value given in the &amp;lt;code&amp;gt;!PropParam&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Properties:&lt;br /&gt;
Pose32x32_Properties:&lt;br /&gt;
    db $20,$20,$20,$20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Palette Effect ==&lt;br /&gt;
The files with extension &amp;quot;.paleffect&amp;quot; are json files that are used for multiple color palette effects, both global and normal, these files can be created using the tool &amp;quot;Palette Effect Creator&amp;quot; that is included with Dynamic X.&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;Name&amp;quot;: ...,&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [...]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Name&#039;&#039;&#039;: This is the name of the color palette effect set. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Name&amp;quot;: &amp;quot;DecreaseSaturation&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Effects&#039;&#039;&#039;: It is a list with each of the color palette effects, these have 7 parameters, the first 3 are Channel1, Channel2 and Channel3 which are values between 0 and 31 that indicate the value of each channel, in the case of an RGB effect, Channel1 is R, Channel2 is G and channel3 is B, in the case of an HSL effect, Channel1 is H, Channel2 is S and Channel3 is L, then come 3 more values, the Ratio1, Ratio2 and Ratio3, each of these is a number between 0 and 31 indicating how much each Channel affects the colors of the color palette, where 0 is that it affects 0% and 31 is that it affects 100%, finally Channels is to indicate whether it is an RGB or HSL effect, 0 is RGB and 1 is HSL. The following example shows 2 HSL effects that decrease saturation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 30,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 31,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Palette Effect Creator ===&lt;br /&gt;
You can find the tool on the official Dynamic X website:&lt;br /&gt;
*[https://snestorage.com/index.php Palette Effect Creator]&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15119</id>
		<title>Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15119"/>
		<updated>2024-01-20T00:36:41Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Palette Effect */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X is an advanced dynamic load management system whose purpose is to support the transfer of graphics and color palettes to the VRAM and CGRAM respectively. This system would replace Dynamic Z V3.7 which in turn is a replacement for DSX.&lt;br /&gt;
== Download ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
= Features =&lt;br /&gt;
*Load Poses Dynamically: Allows to load poses for Dynamic Sprites from any ASM code.&lt;br /&gt;
*Draw Poses: Allows to draw any pose that is registered in the system anywhere on the screen and from any ASM code. The way of drawing is totally optimized for each pose, basically all the poses that have similar characteristics, use the same graphic routine to optimize cycles and to make it as efficient as possible, besides diminishing considerably the amount of ROM used in graphic routines, since, 1 graphic routine can draw hundreds of different poses that belong to different Sprites.&lt;br /&gt;
*Load Graphics to VRAM.&lt;br /&gt;
*Load Color Palettes to the CGRAM.&lt;br /&gt;
*Automatic Palette Assignment: When a Sprite loads a palette, it can ask the system to assign a palette in an automated way, it will look for a free palette and it can be used by the Sprite, in case the palette is already loaded in the loaded CGRAM then it will give the Sprite that palette. The system informs if there are no palettes available, this way, you can avoid that the Sprite tries to work with wrong palettes.&lt;br /&gt;
*Color Palette Effects: You can edit the palettes that are loaded to change attributes such as Hue, Saturation and Brightness, you can weight them with a preset color or de-power certain RGB or HSL channels.&lt;br /&gt;
*Registration of Graphics and Palettes: The system allows you to insert graphics and palettes in the ROM, when you do so, the position in which they were saved in the ROM are available and you can also know the ID with which it was registered in the system, you can use that ID to dynamically load those graphics. Dynamic X will take care of deleting the graphics and palettes previously saved by the system and insert the new graphics and palettes in a free place in the ROM.&lt;br /&gt;
== Features that may have compatibility issues ==&lt;br /&gt;
*Custom Player Graphics: Dynamic X allows you to either change the player graphics using an EXGFX similar to GFX32 being limited to use the size and number of poses of the Vanilla game or simply disable completely the dynamic loading of player graphics, yoshi or podoboos to make your own dynamic routine for a custom player without limitations of size or number of poses. This feature allows you to change the graphics at any time, so you could use different players in different levels or in different areas of the same level.&lt;br /&gt;
*Player Custom Palettes: Dynamic X allows you to change the player&#039;s color palette freely.&lt;br /&gt;
*Player DMA optimizations: Dynamic X decreases considerably the cycles used by the NMI handler, since, the player graphics, yoshi and podoboos are only loaded in the VRAM when they are required, not always as it happens in the Vanilla game. This also leaves you some extra tiles in SP1 in levels that don&#039;t use yoshi or podoboos, even an extra tile in levels that don&#039;t use the layer.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
= Installation =&lt;br /&gt;
== General Steps ==&lt;br /&gt;
Before installing Dynamic X.&lt;br /&gt;
# The ROM must have SA-1 Pack installed.&lt;br /&gt;
# Put all files with &amp;quot;.drawinfo&amp;quot; extension in the &amp;quot;DrawInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.dynamicinfo&amp;quot; extension in the &amp;quot;DynamicInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.paleffect&amp;quot; extension in the &amp;quot;PaletteEffects&amp;quot; folder.&lt;br /&gt;
# Put all resource files such as GFXs and Color Palettes with &amp;quot;.bin&amp;quot; extension in the &amp;quot;DynamicResources&amp;quot; folder.&lt;br /&gt;
== Using the Tool Directly ==&lt;br /&gt;
You can install Dynamic X by opening the file &amp;quot;DynamicXTool.exe&amp;quot;, it will open a console telling you what to type at any given moment. It will start asking you for the ROM paths, Pixi folder, UberasmTool or GPS (these last 3 are optional) and then it will ask you for the features you want to install, put &amp;quot;y&amp;quot; or &amp;quot;yes&amp;quot; to enable each feature and &amp;quot;n&amp;quot; or &amp;quot;no&amp;quot; to disable that feature.&lt;br /&gt;
Warning: Features such as Player Features and Status Bar Optimization, may have incompatibilities with other resources, so you should be careful when installing them. Be careful which features you install.&lt;br /&gt;
&lt;br /&gt;
== Using the Tool From Console ==&lt;br /&gt;
You must call the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ROM will install with the default settings if you have never done a previous installation, if you have done a previous installation, then the settings used in that installation will be used.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
In case you want to change the settings manually you must open the settings.json file that will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must change the parameters according to the settings you want.&lt;br /&gt;
= Formats =&lt;br /&gt;
== Dynamic Info ==&lt;br /&gt;
Files with extension &amp;quot;.dynamicinfo&amp;quot; are used to insert pose graphics, palettes and other resources into the ROM. They also include the information necessary for the poses to be loaded correctly into the VRAM.&lt;br /&gt;
&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Below this label goes each graphics file used to load dynamic poses. Example: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Below this label goes each color palette file used for dynamic poses. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesSizes&#039;&#039;&#039;&#039;: Below this file goes 2 lines for each pose, the first line is a label describing the pose and the second line is 2 values, each of these values indicates how many 8x8 tiles are used in each chunk, each dynamic pose has 2 chunks of data generally (except some exceptions that may require only 1 chunk), the top chunk and the bottom chunk. The top chunk is all the 8x8 tiles that are before the last 8 pixels high line, while the bottom chunk is the last line. In the following example you can see 3 images, the left one is how the assembled image should look like, the second one is how it would look like in the VRAM and the third one is how it would be saved in the binary file, it would also show how the poses sizes of that pose are, which in this case would be 8 tiles of the top chunk and 8 tiles of the bottom chunk:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: For poses whose number of 8x8 tiles is divisible by 32, you can use only the top chunk that has all the tiles and the bottom chunk would be 0.&lt;br /&gt;
&lt;br /&gt;
== Draw Info ==&lt;br /&gt;
The files with extension &amp;quot;.drawinfo&amp;quot;, have the necessary information to draw poses, these poses can be dynamic or static poses. Dynamic X uses these files to generate optimized graphic routines for each pose, the tool detects if one of the tables is necessary or not, eliminates redundant data, pigeonholes each pose in a group that shares similar characteristics and then inserts a graphic routine for each group of poses that share similar characteristics.&lt;br /&gt;
The file format is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: If true it is dynamic, if false it is static, example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: It is a table that indicates which tiles each pose uses, in the case of the dynamic poses it must be considered that the tile of more superior to the left is the tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, this table contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; and the second line would be each one of the tiles used by the pose This table is optional and in case it is not, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the tiles of the pose.This table is optional and in case it is not present, it will use the value $00 for the tiles of the pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: It is a table that indicates the horizontal displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move horizontally each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped horizontally, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping. The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;YDisplacements&#039;&#039;&#039;: It is a table that indicates the vertical displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_YDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move vertically each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped vertically, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_YDispFlipY:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping. The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
YDisplacements:&lt;br /&gt;
Pose32x32_YDisp:&lt;br /&gt;
    db $00,$00,$10,$10&lt;br /&gt;
Pose32x32_YDispFlipY:&lt;br /&gt;
    db $10,$10,$00,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Sizes&#039;&#039;&#039;: Is a table indicating the size of each tile used, each value is &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for 8x8 tiles and &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for 16x16 tiles. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the size of each tile. This table is optional and in case it does not exist, it will use the value &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Sizes:&lt;br /&gt;
Pose32x32_Sizes:&lt;br /&gt;
    db $02,$02,$02,$02&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Properties&#039;&#039;&#039;: Is a table indicating the properties of each tile, the properties follow the format YXCCPPPT, where X is if the tile is flipped horizontally, Y is if the tile is flipped vertically, CC is the priority with respect to layer 1 and layer 2, where 00 is the lowest priority and 11 is the highest, CCC is the color palette used by the tile and T is 1 for using SP3/SP4 and 0 for SP1/SP2. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the property of each tile. This table is optional and in case it does not exist, it will use the value given in the &amp;lt;code&amp;gt;!PropParam&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Properties:&lt;br /&gt;
Pose32x32_Properties:&lt;br /&gt;
    db $20,$20,$20,$20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Palette Effect ==&lt;br /&gt;
The files with extension &amp;quot;.paleffect&amp;quot; are json files that are used for multiple color palette effects, both global and normal, these files can be created using the tool &amp;quot;Palette Effect Creator&amp;quot; that is included with Dynamic X.&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;Name&amp;quot;: ...,&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [...]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Name&#039;&#039;&#039;&#039;: This is the name of the color palette effect set. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Name&amp;quot;: &amp;quot;DecreaseSaturation&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Effects&#039;&#039;&#039;&#039;: It is a list with each of the color palette effects, these have 7 parameters, the first 3 are Channel1, Channel2 and Channel3 which are values between 0 and 31 that indicate the value of each channel, in the case of an RGB effect, Channel1 is R, Channel2 is G and channel3 is B, in the case of an HSL effect, Channel1 is H, Channel2 is S and Channel3 is L, then come 3 more values, the Ratio1, Ratio2 and Ratio3, each of these is a number between 0 and 31 indicating how much each Channel affects the colors of the color palette, where 0 is that it affects 0% and 31 is that it affects 100%, finally Channels is to indicate whether it is an RGB or HSL effect, 0 is RGB and 1 is HSL. The following example shows 2 HSL effects that decrease saturation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 30,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 31,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Palette Effect Creator ===&lt;br /&gt;
You can find the tool on the official Dynamic X website:&lt;br /&gt;
*[https://snestorage.com/index.php Palette Effect Creator]&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/Dynamic_X&amp;diff=15118</id>
		<title>es/Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/Dynamic_X&amp;diff=15118"/>
		<updated>2024-01-20T00:20:23Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Palette Effect */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X es un sistema avanzado de manejo de carga dinámica cuyo propósito es otorgar soporte a la transferencia de gráficos y paletas de colores a la VRAM y CGRAM respectivamente. Este sistema vendría a reemplazar al Dynamic Z V3.7 que a su ves es un reemplazo del DSX.&lt;br /&gt;
== Descarga ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
== Funcionalidades ==&lt;br /&gt;
* Cargar Poses Dinámicamente: Permite cargar poses para Sprites Dinámicos desde cualquier código ASM.&lt;br /&gt;
* Dibujar Poses: Permite dibujar cualquier pose que este registrada en el sistema en cualquier lugar de la pantalla y desde cualquier código ASM. La forma de dibujar esta totalmente optimizada para cada pose, básicamente todas las poses que tienen características similares, usan la misma rutina grafica para optimizar ciclos y que sea lo más eficiente posible, además de disminuir considerablemente la cantidad de ROM utilizada en rutinas graficas, ya que, 1 rutina grafica puede dibujar cientos de poses distintas que pertenecen a distintos Sprites.&lt;br /&gt;
* Cargar Gráficos a la VRAM.&lt;br /&gt;
* Cargar Paletas de Colores a la CGRAM.&lt;br /&gt;
* Asignación Automática de Paletas: Cuando un Sprite carga una paleta, puede pedir al sistema que le asigne una paleta de forma automatizada, este buscara una paleta libre y podrá ser usada por el Sprite, en caso que la paleta ya este cargada en la CGRAM cargada entonces le dará al Sprite esa paleta. El sistema informa si no hay paletas disponibles, de esta manera, se puede evitar que el Sprite intente funcionar con paletas erróneas.&lt;br /&gt;
* Efectos de Paletas de Colores: Se puede editar las paletas que están cargadas para que cambien atributos como el Hue (Tinte), la Saturación y el Brillo, se pueden ponderar con un color preestablecido o también quitarle potencia a ciertos canales RGB o HSL.&lt;br /&gt;
* Registro de Gráficos y Paletas: El sistema permite insertar gráficos y paletas en el ROM, al hacerlo quedan disponibles la posición en que fueron guardados en el ROM y además puedes saber el ID con que fue registrado en el sistema, puedes utilizar ese ID para cargar dinámicamente esos gráficos. Dynamic X se hará cargo de eliminar los gráficos y paletas guardados previamente por el sistema e insertar los nuevos gráficos y paletas en un lugar libre en la ROM.&lt;br /&gt;
=== Funcionalidades que pueden tener problemas de compatibilidad ===&lt;br /&gt;
* Gráficos Custom para el Player: Dynamic X permite tanto cambiar los gráficos del player usando un EXGFX similar al GFX32 estando limitado a que use el tamaño y la cantidad de poses del juego Vanilla o simplemente deshabilitar completamente la carga dinámica de gráficos del player, yoshi o podoboos para hacer tu propia rutina dinámica para un player custom sin limitaciones de tamaño o cantidad de poses. Esta funcionalidad permite cambiar los gráficos en cualquier momento, por lo que podrías usar distintos players en distintos niveles o en distintas zonas del mismo nivel.&lt;br /&gt;
* Paletas Custom para el Player: Dynamic X te permite cambiar la paleta de colores del player libremente.&lt;br /&gt;
* Optimizaciones del DMA del Player: Dynamic X disminuye considerablemente los ciclos utilizados por el NMI handler, ya que, los gráficos del player, yoshi y podoboos solo son cargados en la VRAM cuando son requeridos, no siempre como ocurre en el juego Vanilla. Esto además te deja algunos tiles extras en el SP1 en niveles que no utilicen a yoshi o podoboos, incluso un tile extra en niveles que no usen la capa.&lt;br /&gt;
&lt;br /&gt;
== Requisitos ==&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
&lt;br /&gt;
== Instalación ==&lt;br /&gt;
=== Pasos Generales ===&lt;br /&gt;
Antes de instalar el Dynamic X.&lt;br /&gt;
# El ROM debe tener instalado SA-1 Pack.&lt;br /&gt;
# Poner todos los archivos con extensión &amp;quot;.drawinfo&amp;quot; en la carpeta &amp;quot;DrawInfo&amp;quot;.&lt;br /&gt;
# Poner todos los archivos con extensión &amp;quot;.dynamicinfo&amp;quot; en la carpeta &amp;quot;DynamicInfo&amp;quot;.&lt;br /&gt;
# Poner todos los archivos con extension &amp;quot;.paleffect&amp;quot; en la carpeta &amp;quot;PaletteEffects&amp;quot;.&lt;br /&gt;
# Poner todos los archivos de recursos como GFXs y Paletas de colores que tienen extension &amp;quot;.bin&amp;quot; en la carpeta &amp;quot;DynamicResources&amp;quot;.&lt;br /&gt;
==== Usando el Tool Directamente ====&lt;br /&gt;
Puedes instalar el Dynamic X dándole abriendo el archivo &amp;quot;DynamicXTool.exe&amp;quot;, al hacerlo se te abrirá una consola diciéndote que escribir en cada momento. Iniciara preguntandote por los paths del ROM, carpeta de Pixi, UberasmTool o GPS (estos ultimos 3 son optativos) y luego te preguntara por los features que quieres instalar, pon &amp;quot;y&amp;quot; o &amp;quot;yes&amp;quot; para habilitar cada feature y &amp;quot;n&amp;quot; o &amp;quot;no para deshabilitar ese feature.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advertencia&#039;&#039;&#039;: Los features como Player Features y Status Bar Optimization, pueden tener incompatibilidades con otros recursos, así que debes tener cuidado al instalarlos. Tener cuidado con que features instalan.&lt;br /&gt;
&lt;br /&gt;
==== Usando el Tool Desde Consola ====&lt;br /&gt;
Debes llamar el comando:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
El ROM se instalara con los settings default si nunca se ha hecho una instalación previa, si se ha hecho una instalación previa, entonces se usaran los settings usados en esa instalación.&lt;br /&gt;
&lt;br /&gt;
===== Settings =====&lt;br /&gt;
En caso de querer cambiar los settings manualmente debes abrir el archivo settings.json que se vera así:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Debes cambiar los parámetros según los settings que desees.&lt;br /&gt;
&lt;br /&gt;
== Mejoras en Comparación a otros sistemas ==&lt;br /&gt;
=== Dynamic X VS DSX ===&lt;br /&gt;
* Dynamic X contiene muchos features que DSX no posee. El DSX solo posee soporte para sprites dinámicos. Por favor ver capitulo [https://sneslab.net/mw/index.php?title=es/Dynamic_X&amp;amp;action=edit&amp;amp;section=1 Funcionalidades].&lt;br /&gt;
* DSX permite máximo 4 sprites dinámicos de 32x32, 2 de 48x48 o 1 de 64x64. Dynamic X tiene menos limitaciones en el número de sprites, primero por que todos los sprites comparten poses, por lo tanto, si hay 2 sprites iguales es muy probable que puedas usar todos los que quieras en pantalla sin problemas, segundo puedes decirle al Dynamic X que espacio dinámico usar y dependiendo de ese espacio tienes más o menos limite para sprites dinámicos, de hecho, no existe un limite para sprites dinámicos como tal debido a que si un sprite no puede cargar una pose en la vram, usa la ultima pose que logro cargar, por lo tanto, en el peor de los casos el sprite quedaría con su pose congelada por un momento hasta que sea capaz de cargar una nueva pose.&lt;br /&gt;
* DSX requiere copiar una rutina a todos los sprites que usan su sistema, Dynamic X es solo llamar una rutina de la API, en 3 lineas de codigo puedes subir una pose a la VRAM y dibujar esa pose, eso hace al Dynamic X mucho más eficiente en ROM.&lt;br /&gt;
* DSX no tiene sistema de dibujado, el sprite debe tener su propia rutina gráfica, lo que no solo hace que cada pose dinámica sea solo utilizable dentro del contexto del sprite, sino que gasta mucha más ROM al tener que hacer esa rutina gráfica. Dynamic X por otro lado, permite cargar cualquier pose dinámica y dibujarla desde cualquier código ASM, lo que le da mucha más flexibilidad de uso y además al tener un sistema centralizado de dibujo, se ahorra mucho espacio en ROM.&lt;br /&gt;
* El DSX permite como máximo, cargar poses dinámicas de 64x64 (16 tiles de 16x16), Dynamic X no tiene un limite, si puedes optimizar el NMI handler podrías teóricamente hacer poses de hasta 96x96 (32~36 tiles de 16x16), aunque sin optimizaciones fuertes y solo desactivando las exanimations vanilla, podrías conseguir un sprite 80x80 (24~25 tiles de 16x16).&lt;br /&gt;
* Los gráficos del Dynamic X, son optimizados, esto significa que a pesar de no estar comprimidos con algoritmos como LZ, si usan la menor cantidad de tiles de 16x16 y 8x8 posibles, por lo tanto, esto permite utilizar sprites más grandes y optimizar las transferencias a la VRAM, lo que aumenta su capacidad de tener más poses dinámicas cargadas en la VRAM. El DSX por su parte, los gráficos no tienen ningún tipo de optimización y suelen malgastar mucho espacio con zonas en blanco.&lt;br /&gt;
* El DSX usa un buffer que luego es enviado a la VRAM, esto es un problema debido a que generar ese buffer es muy lento y requiere muchos ciclos, además el DSX debe generar este buffer en cada frame, por lo que un sprite dinámico hecho para DSX suele ser muy lento y utilizar muchos recursos, incluso utilizando SA-1 podrías tener problemas de slowdown si utilizas sprites dinámicos y algún efecto de hdma que sea complejo como un parallax o un wave. El Dynamic X no utiliza un buffer, si no que usa cola de transferencias que se carga directamente a la VRAM sin buffers intermedios, no solo eso, sino que cada pose es cargada solo cuando es necesario, por lo tanto, la carga no se hace en cada frame, sino cuando es necesario, además en ciertos sprites puedes sincronizar la animación para que todos usen exactamente la misma pose o una pose que ya esta cargada en la VRAM, esto reduce considerablemente el slowdown.&lt;br /&gt;
&lt;br /&gt;
=== Dynamic X VS Dynamic Z V3.7 ===&lt;br /&gt;
&lt;br /&gt;
== Formatos ==&lt;br /&gt;
=== Dynamic Info ===&lt;br /&gt;
Los archivos con extensión &amp;quot;.dynamicinfo&amp;quot; se utilizan para insertar gráficos de poses, paletas y otros recursos en el ROM. Además incluyen la información necesaria para que las poses sean cargadas correctamente en la VRAM.&lt;br /&gt;
&lt;br /&gt;
El formato de estos archivos es el siguiente:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Debajo de este label va cada archivo de gráficos utilizado para cargar poses dinámicas. Ejemplo: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Debajo de este label va cada archivo de paletas de colores utilizado para las poses dinámicas. Ejemplo: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Resources&#039;&#039;&#039;: Debajo de este label va cada archivo extra que se utilice como recurso y que se desee insertar en el ROM. Ejemplo: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Resources:&lt;br /&gt;
    Geno.bin&lt;br /&gt;
    GenoPal.bin&lt;br /&gt;
    FireGenoPal.bin&lt;br /&gt;
    GenoPalPlayer2.bin&lt;br /&gt;
    FireGenoPalPlayer2.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesSizes&#039;&#039;&#039;: Debajo de este archivo van 2 líneas por cada pose, la primera linea es un label que describe la pose y la segunda linea son 2 valores, cada uno de estos valores indica cuantos tiles de 8x8 se usan en cada chunk, cada pose dinámica tiene 2 chunks de data generalmente (excepto algunas excepciones que pueden requerir solo 1 chunk), el chunk de arriba y el chunk de abajo. El chunk de arriba son todos los tiles de 8x8 que están antes de la ultima linea de 8 pixeles de alto, mientras que el chunk de abajo es la ultima linea. En el siguiente ejemplo se pueden ver 3 imagenes, la de la izquierda es como deberia verse la imagen ensamblada, la segunda es como se veria en la VRAM y la tercera es como estaria guardado en el archivo binario, tambien mostraria como son los poses sizes de esa pose, que en este caso serian 8 tiles del chunk de arriba y 8 tiles del chunk de abajo:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nota: Para poses cuyo número de tiles de 8x8 sea divisible por 32, se puede usar solo el chunk de arriba que tiene todos los tiles y el chunk de abajo quedaria en 0.&lt;br /&gt;
&lt;br /&gt;
=== Draw Info ===&lt;br /&gt;
Los archivos con extensión &amp;quot;.drawinfo&amp;quot;, tienen la información necesaria para dibujar poses, estas poses pueden ser dinámicas o poses estáticas. El Dynamic X utiliza estos archivos para generar rutinas gráficas optimizadas para cada pose, el tool detecta si es necesaria o no una de las tablas, elimina data redundante o que no aporta, encasilla cada pose en un grupo que comparte características similares y luego inserta una rutina gráfica por cada grupo de poses que comparten características similares.&lt;br /&gt;
El formato del archivo es el siguiente:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: Si es true es dinámica, si es false es estatica, ejemplo:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: Es una tabla que indica que tiles utiliza cada pose, en el caso de las poses dinámicas debe considerarse que el tile de más arriba a la izquierda es el tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, esta tabla contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; y la segunda línea seria cada uno de los tiles utilizado por la pose. Esta tabla es optativa y en caso de que no este, utilizara el valor &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: Es una tabla que indica el desplazamiento horizontal de cada tile con respecto a la posición de la pose y contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code&amp;gt; y la segunda línea es un valor por cada tile de la pose indicando cuanto debe moverse horizontalmente cada tile con respecto a la posición de la pose, adicionalmente se pueden añadir 2 líneas más por cada pose para cuando la pose es volteada horizontalmente, el formato es el mismo de las 2 líneas anteriores solo que la primera línea es &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code&amp;gt;. Esta tabla es optativa y en caso de no existir, utilizara el valor &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32 y permitiendo volteo horizontal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;YDisplacements&#039;&#039;&#039;: Es una tabla que indica el desplazamiento vertical de cada tile con respecto a la posición de la pose y contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_YDisp:&amp;lt;/code&amp;gt; y la segunda línea es un valor por cada tile de la pose indicando cuanto debe moverse verticalmente cada tile con respecto a la posición de la pose, adicionalmente se pueden añadir 2 líneas más por cada pose para cuando la pose es volteada verticalmente, el formato es el mismo de las 2 líneas anteriores solo que la primera línea es &amp;lt;code&amp;gt;PoseName_YDispFlipY:&amp;lt;/code&amp;gt;. Esta tabla es optativa y en caso de no existir, utilizara el valor &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32 y permitiendo volteo vertical:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
YDisplacements:&lt;br /&gt;
Pose32x32_YDisp:&lt;br /&gt;
    db $00,$00,$10,$10&lt;br /&gt;
Pose32x32_YDispFlipY:&lt;br /&gt;
    db $10,$10,$00,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Sizes&#039;&#039;&#039;: Es una tabla que indica el tamaño de cada uno de los tiles que se utiliza, cada valor es &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; para tiles de 8x8 y &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; para tiles de 16x16. Contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; y la segunda línea es un valor por cada tile de la pose indicando el tamaño de cada tile. Esta tabla es optativa y en caso de no existir, utilizara el valor &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Sizes:&lt;br /&gt;
Pose32x32_Sizes:&lt;br /&gt;
    db $02,$02,$02,$02&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Properties&#039;&#039;&#039;: Es una tabla que indica las propiedades de cada tile, las propiedades siguen el formato YXCCPPPT, donde X es si el tile es volteado horizontalmente, Y es si el tile es volteado verticalmente, CC es la prioridad con respecto al layer 1 y layer 2, donde 00 es la prioridad más baja y 11 es la más alta, CCC es la paleta de colores usada por el tile y T es 1 para usar SP3/SP4 y 0 para SP1/SP2. Contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; y la segunda línea es un valor por cada tile de la pose indicando la propiedad de cada tile. Esta tabla es optativa y en caso de no existir, utilizara el valor que se entregue en el &amp;lt;code&amp;gt;!PropParam&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Properties:&lt;br /&gt;
Pose32x32_Properties:&lt;br /&gt;
    db $20,$20,$20,$20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Palette Effect ===&lt;br /&gt;
Los archivos con extensión &amp;quot;.paleffect&amp;quot; son archivos json que se utilizan para múltiples efectos de paletas de colores, tanto globales como normales, estos archivos pueden ser creados utilizando el tool &amp;quot;Palette Effect Creator&amp;quot; que es incluido al Dynamic X.&lt;br /&gt;
El formato de estos archivos es el siguiente:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;Name&amp;quot;: ...,&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [...]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Name&#039;&#039;&#039;: Es el nombre del conjunto de efectos de paletas de colores. Ejemplo:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Name&amp;quot;: &amp;quot;DecreaseSaturation&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Effects&#039;&#039;&#039;: Es una lista con cada uno de los efectos de paletas de colores, estos tienen 7 parámetros, los primeros 3 son Channel1, Channel2 y Channel3 que son valores entre 0 y 31 que indican el valor de cada canal, en el caso de un efecto RGB, el Channel1 es R, el Channel2 es G y el channel3 es B, en el caso de un efecto HSL, el Channel1 es H, el Channel2 es S y el Channel3 es L, luego vienen 3 valores más, el Ratio1, Ratio2 y Ratio3, cada uno de estos es un número entre 0 y 31 indicando cuanto afecta cada Channel a los colores de la paleta de colores, donde 0 es que afecta en un 0% y 31 es que afecta en un 100%, por ultimo Channels es para indicar si es un efecto RGB o HSL, 0 es RGB y 1 es HSL. El sguiente ejemplo muestra 2 efectos HSL que disminuyen la saturación:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 30,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 31,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Palette Effect Creator ===&lt;br /&gt;
Puedes encontrar el tool en el sitio web oficial de Dynamic X:&lt;br /&gt;
*[https://snestorage.com/index.php Palette Effect Creator]&lt;br /&gt;
&lt;br /&gt;
== Modo de Uso ==&lt;br /&gt;
=== Carga Dinámica de Poses ===&lt;br /&gt;
==== Cambiar Configuración de Espacio para Poses Dinámicas ====&lt;br /&gt;
&lt;br /&gt;
=== Dibujar Poses ===&lt;br /&gt;
=== Carga y Dibujo de Poses en Sprites ===&lt;br /&gt;
Los sprites (Sprites normales, clusters y extended) poseen rutinas especiales que se insertan en las Shared Routines de Pixi al momento de instalar el Dynamic X, estas rutinas simplifican considerablemente el trabajar con poses dinámicas y con el sistema de dibujo del Dinamic X.&lt;br /&gt;
==== Upload ====&lt;br /&gt;
La primera rutina es &#039;&#039;&#039;Upload&#039;&#039;&#039;, esta rutina carga en el espacio destinado para poses Dinámicas, la pose que deseas. Posee 2 versiones el &#039;&#039;&#039;Upload&#039;&#039;&#039; normal y el &#039;&#039;&#039;UploadWithoutPoseOffset&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Upload&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Versiones&#039;&#039;&#039;: %DXNormalUpload(), %DXClusterUpload(), %DXExtendedUpload().&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Input&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A&#039;&#039;&#039;: ID de la pose base (16 bits). Se puede usar el define autogenerado por Dynamic X que es &amp;lt;code&amp;gt;!DynamicPoseID&amp;lt;Nombre del Dynamic Info&amp;gt;000&amp;lt;/code&amp;gt;. Ejemplo: &amp;lt;code&amp;gt;!DynamicPoseIDDKCKlaptrap000&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;!PoseIndex,x&#039;&#039;&#039;: La pose dentro del contexto que se desea cargar. Se calcula la pose como &amp;lt;code&amp;gt;A + !PoseIndex,x&amp;lt;/code&amp;gt;. Por ejemplo si deseamos la pose 5 de Klaptrap en A se pondria &amp;lt;code&amp;gt;!DynamicPoseIDDKCKlaptrap000&amp;lt;/code&amp;gt; y en &amp;lt;code&amp;gt;!PoseIndex,x&amp;lt;/code&amp;gt; pondriamos el valor &amp;lt;code&amp;gt;$05&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Output&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Carry&#039;&#039;&#039;: Si despues de la rutina hay un Carry Set, puede significar 3 cosas:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
La pose fue cargada con éxito.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
La pose ya estaba cargada previamente y se esta reutilizando.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
La pose no fue cargada y no fue encontrada, pero en un ciclo anterior si se cargo una pose en la VRAM y se puede usar.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Si el Carry es un Carry Clear, la pose no pudo ser cargada y previamente no se cargo ninguna pose, en este caso lo recomendable seria despawnear el sprite, excepto si es un Boss o un sprite que debe ser persistente en el nivel. &lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;!LastPoseIndex,x&#039;&#039;&#039;: Tendrá el valor de la ultima pose que fue cargada a la VRAM. Al momento de dibujar o de hacer una rutina de interacción que tenga cajas de colisión dependientes de la pose, se debería utilizar esta tabla. Si es &amp;lt;code&amp;gt;$FF&amp;lt;/code&amp;gt; entonces nunca se ha cargado una pose previamente.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;!LastPoseHashIndex,x&#039;&#039;&#039;: Es de uso interno, pero básicamente contendrá el valor del ID que indexa la tabla hash de poses de la ultima pose que fue cargada. Si es &amp;lt;code&amp;gt;$FF&amp;lt;/code&amp;gt; entonces nunca se ha cargado una pose previamente.  Si es &amp;lt;code&amp;gt;$FF&amp;lt;/code&amp;gt; entonces nunca se ha cargado una pose previamente.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;!LastFlip,x&#039;&#039;&#039;: Es el valor de &amp;lt;code&amp;gt;!GlobalFlip,x XOR !LocalFlip,x&amp;lt;/code&amp;gt; que tenia la ultima pose que fue cargada. Al momento de dibujar o de hacer una rutina de interacción que tenga cajas de colisión dependientes de la pose, se debería utilizar esta tabla. Si es &amp;lt;code&amp;gt;$FF&amp;lt;/code&amp;gt; entonces nunca se ha cargado una pose previamente.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;$04&#039;&#039;&#039;: Tendra el valor &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; si el primer tile de la pose esta cargado en SP1 o SP2, o &amp;lt;code&amp;gt;$01&amp;lt;/code&amp;gt; si el primer tile de la pose fue cargado en SP3 o SP4.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;$08&#039;&#039;&#039;: Tiene el Offset del primer Tile que se cargo en la pose.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;UploadWithoutPoseOffset&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Versiones&#039;&#039;&#039;: %DXNormalUploadWithoutPoseOffset(), %DXClusterUploadWithoutPoseOffset(), %DXExtendedUploadWithoutPoseOffset().&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Input&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A&#039;&#039;&#039;: ID de la pose deseada (16 bits). Puedes utilizar los defines autogenerados por Dynamic X para la pose que inician con &amp;lt;code&amp;gt;!DynamicPoseID&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Outputs&#039;&#039;&#039;: Los mismos de &#039;&#039;&#039;Upload&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
==== Draw ====&lt;br /&gt;
La segunda rutina es &#039;&#039;&#039;Draw&#039;&#039;&#039;, esta rutina se encarga de dibujar una pose, puede recibir ciertos parámetros para cambiar las propiedades, la posición o la prioridad de la pose. Tiene 2 versiones distintas &#039;&#039;&#039;Draw&#039;&#039;&#039; y &#039;&#039;&#039;DrawWithOffset&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Draw&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Versiones&#039;&#039;&#039;: %DXNormalDraw(), %DXClusterDraw(), %DXExtendedDraw()&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Inputs&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DrawWithOffset&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Versiones&#039;&#039;&#039;: %DXNormalDrawWithOffset(), %DXClusterDrawWithOffset(), %DXExtendedDrawWithOffset()&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Carga de Gráficos ===&lt;br /&gt;
=== Carga de Paletas ===&lt;br /&gt;
=== Paletas de Sprites ===&lt;br /&gt;
==== Asignación de Paletas ====&lt;br /&gt;
===== Restringir Sobre escritura de Paletas =====&lt;br /&gt;
&lt;br /&gt;
=== Efectos de paletas ===&lt;br /&gt;
=== Cambiar Gráficos del Player usando un GFX similar al GFX32 ===&lt;br /&gt;
=== Cambiar Gráficos del Player ===&lt;br /&gt;
=== Cambiar Paleta del Player ===&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15117</id>
		<title>Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15117"/>
		<updated>2024-01-20T00:20:22Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Draw Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X is an advanced dynamic load management system whose purpose is to support the transfer of graphics and color palettes to the VRAM and CGRAM respectively. This system would replace Dynamic Z V3.7 which in turn is a replacement for DSX.&lt;br /&gt;
== Download ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
= Features =&lt;br /&gt;
*Load Poses Dynamically: Allows to load poses for Dynamic Sprites from any ASM code.&lt;br /&gt;
*Draw Poses: Allows to draw any pose that is registered in the system anywhere on the screen and from any ASM code. The way of drawing is totally optimized for each pose, basically all the poses that have similar characteristics, use the same graphic routine to optimize cycles and to make it as efficient as possible, besides diminishing considerably the amount of ROM used in graphic routines, since, 1 graphic routine can draw hundreds of different poses that belong to different Sprites.&lt;br /&gt;
*Load Graphics to VRAM.&lt;br /&gt;
*Load Color Palettes to the CGRAM.&lt;br /&gt;
*Automatic Palette Assignment: When a Sprite loads a palette, it can ask the system to assign a palette in an automated way, it will look for a free palette and it can be used by the Sprite, in case the palette is already loaded in the loaded CGRAM then it will give the Sprite that palette. The system informs if there are no palettes available, this way, you can avoid that the Sprite tries to work with wrong palettes.&lt;br /&gt;
*Color Palette Effects: You can edit the palettes that are loaded to change attributes such as Hue, Saturation and Brightness, you can weight them with a preset color or de-power certain RGB or HSL channels.&lt;br /&gt;
*Registration of Graphics and Palettes: The system allows you to insert graphics and palettes in the ROM, when you do so, the position in which they were saved in the ROM are available and you can also know the ID with which it was registered in the system, you can use that ID to dynamically load those graphics. Dynamic X will take care of deleting the graphics and palettes previously saved by the system and insert the new graphics and palettes in a free place in the ROM.&lt;br /&gt;
== Features that may have compatibility issues ==&lt;br /&gt;
*Custom Player Graphics: Dynamic X allows you to either change the player graphics using an EXGFX similar to GFX32 being limited to use the size and number of poses of the Vanilla game or simply disable completely the dynamic loading of player graphics, yoshi or podoboos to make your own dynamic routine for a custom player without limitations of size or number of poses. This feature allows you to change the graphics at any time, so you could use different players in different levels or in different areas of the same level.&lt;br /&gt;
*Player Custom Palettes: Dynamic X allows you to change the player&#039;s color palette freely.&lt;br /&gt;
*Player DMA optimizations: Dynamic X decreases considerably the cycles used by the NMI handler, since, the player graphics, yoshi and podoboos are only loaded in the VRAM when they are required, not always as it happens in the Vanilla game. This also leaves you some extra tiles in SP1 in levels that don&#039;t use yoshi or podoboos, even an extra tile in levels that don&#039;t use the layer.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
= Installation =&lt;br /&gt;
== General Steps ==&lt;br /&gt;
Before installing Dynamic X.&lt;br /&gt;
# The ROM must have SA-1 Pack installed.&lt;br /&gt;
# Put all files with &amp;quot;.drawinfo&amp;quot; extension in the &amp;quot;DrawInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.dynamicinfo&amp;quot; extension in the &amp;quot;DynamicInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.paleffect&amp;quot; extension in the &amp;quot;PaletteEffects&amp;quot; folder.&lt;br /&gt;
# Put all resource files such as GFXs and Color Palettes with &amp;quot;.bin&amp;quot; extension in the &amp;quot;DynamicResources&amp;quot; folder.&lt;br /&gt;
== Using the Tool Directly ==&lt;br /&gt;
You can install Dynamic X by opening the file &amp;quot;DynamicXTool.exe&amp;quot;, it will open a console telling you what to type at any given moment. It will start asking you for the ROM paths, Pixi folder, UberasmTool or GPS (these last 3 are optional) and then it will ask you for the features you want to install, put &amp;quot;y&amp;quot; or &amp;quot;yes&amp;quot; to enable each feature and &amp;quot;n&amp;quot; or &amp;quot;no&amp;quot; to disable that feature.&lt;br /&gt;
Warning: Features such as Player Features and Status Bar Optimization, may have incompatibilities with other resources, so you should be careful when installing them. Be careful which features you install.&lt;br /&gt;
&lt;br /&gt;
== Using the Tool From Console ==&lt;br /&gt;
You must call the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ROM will install with the default settings if you have never done a previous installation, if you have done a previous installation, then the settings used in that installation will be used.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
In case you want to change the settings manually you must open the settings.json file that will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must change the parameters according to the settings you want.&lt;br /&gt;
= Formats =&lt;br /&gt;
== Dynamic Info ==&lt;br /&gt;
Files with extension &amp;quot;.dynamicinfo&amp;quot; are used to insert pose graphics, palettes and other resources into the ROM. They also include the information necessary for the poses to be loaded correctly into the VRAM.&lt;br /&gt;
&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Below this label goes each graphics file used to load dynamic poses. Example: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Below this label goes each color palette file used for dynamic poses. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesSizes&#039;&#039;&#039;&#039;: Below this file goes 2 lines for each pose, the first line is a label describing the pose and the second line is 2 values, each of these values indicates how many 8x8 tiles are used in each chunk, each dynamic pose has 2 chunks of data generally (except some exceptions that may require only 1 chunk), the top chunk and the bottom chunk. The top chunk is all the 8x8 tiles that are before the last 8 pixels high line, while the bottom chunk is the last line. In the following example you can see 3 images, the left one is how the assembled image should look like, the second one is how it would look like in the VRAM and the third one is how it would be saved in the binary file, it would also show how the poses sizes of that pose are, which in this case would be 8 tiles of the top chunk and 8 tiles of the bottom chunk:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: For poses whose number of 8x8 tiles is divisible by 32, you can use only the top chunk that has all the tiles and the bottom chunk would be 0.&lt;br /&gt;
&lt;br /&gt;
== Draw Info ==&lt;br /&gt;
The files with extension &amp;quot;.drawinfo&amp;quot;, have the necessary information to draw poses, these poses can be dynamic or static poses. Dynamic X uses these files to generate optimized graphic routines for each pose, the tool detects if one of the tables is necessary or not, eliminates redundant data, pigeonholes each pose in a group that shares similar characteristics and then inserts a graphic routine for each group of poses that share similar characteristics.&lt;br /&gt;
The file format is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: If true it is dynamic, if false it is static, example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: It is a table that indicates which tiles each pose uses, in the case of the dynamic poses it must be considered that the tile of more superior to the left is the tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, this table contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; and the second line would be each one of the tiles used by the pose This table is optional and in case it is not, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the tiles of the pose.This table is optional and in case it is not present, it will use the value $00 for the tiles of the pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: It is a table that indicates the horizontal displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move horizontally each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped horizontally, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping. The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;YDisplacements&#039;&#039;&#039;: It is a table that indicates the vertical displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_YDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move vertically each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped vertically, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_YDispFlipY:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping. The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
YDisplacements:&lt;br /&gt;
Pose32x32_YDisp:&lt;br /&gt;
    db $00,$00,$10,$10&lt;br /&gt;
Pose32x32_YDispFlipY:&lt;br /&gt;
    db $10,$10,$00,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Sizes&#039;&#039;&#039;: Is a table indicating the size of each tile used, each value is &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for 8x8 tiles and &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for 16x16 tiles. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the size of each tile. This table is optional and in case it does not exist, it will use the value &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Sizes:&lt;br /&gt;
Pose32x32_Sizes:&lt;br /&gt;
    db $02,$02,$02,$02&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Properties&#039;&#039;&#039;: Is a table indicating the properties of each tile, the properties follow the format YXCCPPPT, where X is if the tile is flipped horizontally, Y is if the tile is flipped vertically, CC is the priority with respect to layer 1 and layer 2, where 00 is the lowest priority and 11 is the highest, CCC is the color palette used by the tile and T is 1 for using SP3/SP4 and 0 for SP1/SP2. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the property of each tile. This table is optional and in case it does not exist, it will use the value given in the &amp;lt;code&amp;gt;!PropParam&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Properties:&lt;br /&gt;
Pose32x32_Properties:&lt;br /&gt;
    db $20,$20,$20,$20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== Palette Effect ==&lt;br /&gt;
The files with extension &amp;quot;.paleffect&amp;quot; are json files that are used for multiple color palette effects, both global and normal, these files can be created using the tool &amp;quot;Palette Effect Creator&amp;quot; that is included with Dynamic X.&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Name&amp;quot;: &amp;quot;DecreaseSaturation&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Effects&#039;&#039;&#039;&#039;: It is a list with each of the color palette effects, these have 7 parameters, the first 3 are Channel1, Channel2 and Channel3 which are values between 0 and 31 that indicate the value of each channel, in the case of an RGB effect, Channel1 is R, Channel2 is G and channel3 is B, in the case of an HSL effect, Channel1 is H, Channel2 is S and Channel3 is L, then come 3 more values, the Ratio1, Ratio2 and Ratio3, each of these is a number between 0 and 31 indicating how much each Channel affects the colors of the color palette, where 0 is that it affects 0% and 31 is that it affects 100%, finally Channels is to indicate whether it is an RGB or HSL effect, 0 is RGB and 1 is HSL. The following example shows 2 HSL effects that decrease saturation:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 30,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 31,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== Palette Effect Creator ===&lt;br /&gt;
You can find the tool on the official Dynamic X website:&lt;br /&gt;
*[https://snestorage.com/index.php Palette Effect Creator]&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/Dynamic_X&amp;diff=15116</id>
		<title>es/Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/Dynamic_X&amp;diff=15116"/>
		<updated>2024-01-20T00:17:09Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Draw Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X es un sistema avanzado de manejo de carga dinámica cuyo propósito es otorgar soporte a la transferencia de gráficos y paletas de colores a la VRAM y CGRAM respectivamente. Este sistema vendría a reemplazar al Dynamic Z V3.7 que a su ves es un reemplazo del DSX.&lt;br /&gt;
== Descarga ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
== Funcionalidades ==&lt;br /&gt;
* Cargar Poses Dinámicamente: Permite cargar poses para Sprites Dinámicos desde cualquier código ASM.&lt;br /&gt;
* Dibujar Poses: Permite dibujar cualquier pose que este registrada en el sistema en cualquier lugar de la pantalla y desde cualquier código ASM. La forma de dibujar esta totalmente optimizada para cada pose, básicamente todas las poses que tienen características similares, usan la misma rutina grafica para optimizar ciclos y que sea lo más eficiente posible, además de disminuir considerablemente la cantidad de ROM utilizada en rutinas graficas, ya que, 1 rutina grafica puede dibujar cientos de poses distintas que pertenecen a distintos Sprites.&lt;br /&gt;
* Cargar Gráficos a la VRAM.&lt;br /&gt;
* Cargar Paletas de Colores a la CGRAM.&lt;br /&gt;
* Asignación Automática de Paletas: Cuando un Sprite carga una paleta, puede pedir al sistema que le asigne una paleta de forma automatizada, este buscara una paleta libre y podrá ser usada por el Sprite, en caso que la paleta ya este cargada en la CGRAM cargada entonces le dará al Sprite esa paleta. El sistema informa si no hay paletas disponibles, de esta manera, se puede evitar que el Sprite intente funcionar con paletas erróneas.&lt;br /&gt;
* Efectos de Paletas de Colores: Se puede editar las paletas que están cargadas para que cambien atributos como el Hue (Tinte), la Saturación y el Brillo, se pueden ponderar con un color preestablecido o también quitarle potencia a ciertos canales RGB o HSL.&lt;br /&gt;
* Registro de Gráficos y Paletas: El sistema permite insertar gráficos y paletas en el ROM, al hacerlo quedan disponibles la posición en que fueron guardados en el ROM y además puedes saber el ID con que fue registrado en el sistema, puedes utilizar ese ID para cargar dinámicamente esos gráficos. Dynamic X se hará cargo de eliminar los gráficos y paletas guardados previamente por el sistema e insertar los nuevos gráficos y paletas en un lugar libre en la ROM.&lt;br /&gt;
=== Funcionalidades que pueden tener problemas de compatibilidad ===&lt;br /&gt;
* Gráficos Custom para el Player: Dynamic X permite tanto cambiar los gráficos del player usando un EXGFX similar al GFX32 estando limitado a que use el tamaño y la cantidad de poses del juego Vanilla o simplemente deshabilitar completamente la carga dinámica de gráficos del player, yoshi o podoboos para hacer tu propia rutina dinámica para un player custom sin limitaciones de tamaño o cantidad de poses. Esta funcionalidad permite cambiar los gráficos en cualquier momento, por lo que podrías usar distintos players en distintos niveles o en distintas zonas del mismo nivel.&lt;br /&gt;
* Paletas Custom para el Player: Dynamic X te permite cambiar la paleta de colores del player libremente.&lt;br /&gt;
* Optimizaciones del DMA del Player: Dynamic X disminuye considerablemente los ciclos utilizados por el NMI handler, ya que, los gráficos del player, yoshi y podoboos solo son cargados en la VRAM cuando son requeridos, no siempre como ocurre en el juego Vanilla. Esto además te deja algunos tiles extras en el SP1 en niveles que no utilicen a yoshi o podoboos, incluso un tile extra en niveles que no usen la capa.&lt;br /&gt;
&lt;br /&gt;
== Requisitos ==&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
&lt;br /&gt;
== Instalación ==&lt;br /&gt;
=== Pasos Generales ===&lt;br /&gt;
Antes de instalar el Dynamic X.&lt;br /&gt;
# El ROM debe tener instalado SA-1 Pack.&lt;br /&gt;
# Poner todos los archivos con extensión &amp;quot;.drawinfo&amp;quot; en la carpeta &amp;quot;DrawInfo&amp;quot;.&lt;br /&gt;
# Poner todos los archivos con extensión &amp;quot;.dynamicinfo&amp;quot; en la carpeta &amp;quot;DynamicInfo&amp;quot;.&lt;br /&gt;
# Poner todos los archivos con extension &amp;quot;.paleffect&amp;quot; en la carpeta &amp;quot;PaletteEffects&amp;quot;.&lt;br /&gt;
# Poner todos los archivos de recursos como GFXs y Paletas de colores que tienen extension &amp;quot;.bin&amp;quot; en la carpeta &amp;quot;DynamicResources&amp;quot;.&lt;br /&gt;
==== Usando el Tool Directamente ====&lt;br /&gt;
Puedes instalar el Dynamic X dándole abriendo el archivo &amp;quot;DynamicXTool.exe&amp;quot;, al hacerlo se te abrirá una consola diciéndote que escribir en cada momento. Iniciara preguntandote por los paths del ROM, carpeta de Pixi, UberasmTool o GPS (estos ultimos 3 son optativos) y luego te preguntara por los features que quieres instalar, pon &amp;quot;y&amp;quot; o &amp;quot;yes&amp;quot; para habilitar cada feature y &amp;quot;n&amp;quot; o &amp;quot;no para deshabilitar ese feature.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advertencia&#039;&#039;&#039;: Los features como Player Features y Status Bar Optimization, pueden tener incompatibilidades con otros recursos, así que debes tener cuidado al instalarlos. Tener cuidado con que features instalan.&lt;br /&gt;
&lt;br /&gt;
==== Usando el Tool Desde Consola ====&lt;br /&gt;
Debes llamar el comando:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
El ROM se instalara con los settings default si nunca se ha hecho una instalación previa, si se ha hecho una instalación previa, entonces se usaran los settings usados en esa instalación.&lt;br /&gt;
&lt;br /&gt;
===== Settings =====&lt;br /&gt;
En caso de querer cambiar los settings manualmente debes abrir el archivo settings.json que se vera así:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Debes cambiar los parámetros según los settings que desees.&lt;br /&gt;
&lt;br /&gt;
== Mejoras en Comparación a otros sistemas ==&lt;br /&gt;
=== Dynamic X VS DSX ===&lt;br /&gt;
* Dynamic X contiene muchos features que DSX no posee. El DSX solo posee soporte para sprites dinámicos. Por favor ver capitulo [https://sneslab.net/mw/index.php?title=es/Dynamic_X&amp;amp;action=edit&amp;amp;section=1 Funcionalidades].&lt;br /&gt;
* DSX permite máximo 4 sprites dinámicos de 32x32, 2 de 48x48 o 1 de 64x64. Dynamic X tiene menos limitaciones en el número de sprites, primero por que todos los sprites comparten poses, por lo tanto, si hay 2 sprites iguales es muy probable que puedas usar todos los que quieras en pantalla sin problemas, segundo puedes decirle al Dynamic X que espacio dinámico usar y dependiendo de ese espacio tienes más o menos limite para sprites dinámicos, de hecho, no existe un limite para sprites dinámicos como tal debido a que si un sprite no puede cargar una pose en la vram, usa la ultima pose que logro cargar, por lo tanto, en el peor de los casos el sprite quedaría con su pose congelada por un momento hasta que sea capaz de cargar una nueva pose.&lt;br /&gt;
* DSX requiere copiar una rutina a todos los sprites que usan su sistema, Dynamic X es solo llamar una rutina de la API, en 3 lineas de codigo puedes subir una pose a la VRAM y dibujar esa pose, eso hace al Dynamic X mucho más eficiente en ROM.&lt;br /&gt;
* DSX no tiene sistema de dibujado, el sprite debe tener su propia rutina gráfica, lo que no solo hace que cada pose dinámica sea solo utilizable dentro del contexto del sprite, sino que gasta mucha más ROM al tener que hacer esa rutina gráfica. Dynamic X por otro lado, permite cargar cualquier pose dinámica y dibujarla desde cualquier código ASM, lo que le da mucha más flexibilidad de uso y además al tener un sistema centralizado de dibujo, se ahorra mucho espacio en ROM.&lt;br /&gt;
* El DSX permite como máximo, cargar poses dinámicas de 64x64 (16 tiles de 16x16), Dynamic X no tiene un limite, si puedes optimizar el NMI handler podrías teóricamente hacer poses de hasta 96x96 (32~36 tiles de 16x16), aunque sin optimizaciones fuertes y solo desactivando las exanimations vanilla, podrías conseguir un sprite 80x80 (24~25 tiles de 16x16).&lt;br /&gt;
* Los gráficos del Dynamic X, son optimizados, esto significa que a pesar de no estar comprimidos con algoritmos como LZ, si usan la menor cantidad de tiles de 16x16 y 8x8 posibles, por lo tanto, esto permite utilizar sprites más grandes y optimizar las transferencias a la VRAM, lo que aumenta su capacidad de tener más poses dinámicas cargadas en la VRAM. El DSX por su parte, los gráficos no tienen ningún tipo de optimización y suelen malgastar mucho espacio con zonas en blanco.&lt;br /&gt;
* El DSX usa un buffer que luego es enviado a la VRAM, esto es un problema debido a que generar ese buffer es muy lento y requiere muchos ciclos, además el DSX debe generar este buffer en cada frame, por lo que un sprite dinámico hecho para DSX suele ser muy lento y utilizar muchos recursos, incluso utilizando SA-1 podrías tener problemas de slowdown si utilizas sprites dinámicos y algún efecto de hdma que sea complejo como un parallax o un wave. El Dynamic X no utiliza un buffer, si no que usa cola de transferencias que se carga directamente a la VRAM sin buffers intermedios, no solo eso, sino que cada pose es cargada solo cuando es necesario, por lo tanto, la carga no se hace en cada frame, sino cuando es necesario, además en ciertos sprites puedes sincronizar la animación para que todos usen exactamente la misma pose o una pose que ya esta cargada en la VRAM, esto reduce considerablemente el slowdown.&lt;br /&gt;
&lt;br /&gt;
=== Dynamic X VS Dynamic Z V3.7 ===&lt;br /&gt;
&lt;br /&gt;
== Formatos ==&lt;br /&gt;
=== Dynamic Info ===&lt;br /&gt;
Los archivos con extensión &amp;quot;.dynamicinfo&amp;quot; se utilizan para insertar gráficos de poses, paletas y otros recursos en el ROM. Además incluyen la información necesaria para que las poses sean cargadas correctamente en la VRAM.&lt;br /&gt;
&lt;br /&gt;
El formato de estos archivos es el siguiente:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Debajo de este label va cada archivo de gráficos utilizado para cargar poses dinámicas. Ejemplo: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Debajo de este label va cada archivo de paletas de colores utilizado para las poses dinámicas. Ejemplo: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Resources&#039;&#039;&#039;: Debajo de este label va cada archivo extra que se utilice como recurso y que se desee insertar en el ROM. Ejemplo: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Resources:&lt;br /&gt;
    Geno.bin&lt;br /&gt;
    GenoPal.bin&lt;br /&gt;
    FireGenoPal.bin&lt;br /&gt;
    GenoPalPlayer2.bin&lt;br /&gt;
    FireGenoPalPlayer2.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesSizes&#039;&#039;&#039;: Debajo de este archivo van 2 líneas por cada pose, la primera linea es un label que describe la pose y la segunda linea son 2 valores, cada uno de estos valores indica cuantos tiles de 8x8 se usan en cada chunk, cada pose dinámica tiene 2 chunks de data generalmente (excepto algunas excepciones que pueden requerir solo 1 chunk), el chunk de arriba y el chunk de abajo. El chunk de arriba son todos los tiles de 8x8 que están antes de la ultima linea de 8 pixeles de alto, mientras que el chunk de abajo es la ultima linea. En el siguiente ejemplo se pueden ver 3 imagenes, la de la izquierda es como deberia verse la imagen ensamblada, la segunda es como se veria en la VRAM y la tercera es como estaria guardado en el archivo binario, tambien mostraria como son los poses sizes de esa pose, que en este caso serian 8 tiles del chunk de arriba y 8 tiles del chunk de abajo:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nota: Para poses cuyo número de tiles de 8x8 sea divisible por 32, se puede usar solo el chunk de arriba que tiene todos los tiles y el chunk de abajo quedaria en 0.&lt;br /&gt;
&lt;br /&gt;
=== Draw Info ===&lt;br /&gt;
Los archivos con extensión &amp;quot;.drawinfo&amp;quot;, tienen la información necesaria para dibujar poses, estas poses pueden ser dinámicas o poses estáticas. El Dynamic X utiliza estos archivos para generar rutinas gráficas optimizadas para cada pose, el tool detecta si es necesaria o no una de las tablas, elimina data redundante o que no aporta, encasilla cada pose en un grupo que comparte características similares y luego inserta una rutina gráfica por cada grupo de poses que comparten características similares.&lt;br /&gt;
El formato del archivo es el siguiente:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: Si es true es dinámica, si es false es estatica, ejemplo:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: Es una tabla que indica que tiles utiliza cada pose, en el caso de las poses dinámicas debe considerarse que el tile de más arriba a la izquierda es el tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, esta tabla contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; y la segunda línea seria cada uno de los tiles utilizado por la pose. Esta tabla es optativa y en caso de que no este, utilizara el valor &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: Es una tabla que indica el desplazamiento horizontal de cada tile con respecto a la posición de la pose y contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code&amp;gt; y la segunda línea es un valor por cada tile de la pose indicando cuanto debe moverse horizontalmente cada tile con respecto a la posición de la pose, adicionalmente se pueden añadir 2 líneas más por cada pose para cuando la pose es volteada horizontalmente, el formato es el mismo de las 2 líneas anteriores solo que la primera línea es &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code&amp;gt;. Esta tabla es optativa y en caso de no existir, utilizara el valor &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32 y permitiendo volteo horizontal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;YDisplacements&#039;&#039;&#039;: Es una tabla que indica el desplazamiento vertical de cada tile con respecto a la posición de la pose y contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_YDisp:&amp;lt;/code&amp;gt; y la segunda línea es un valor por cada tile de la pose indicando cuanto debe moverse verticalmente cada tile con respecto a la posición de la pose, adicionalmente se pueden añadir 2 líneas más por cada pose para cuando la pose es volteada verticalmente, el formato es el mismo de las 2 líneas anteriores solo que la primera línea es &amp;lt;code&amp;gt;PoseName_YDispFlipY:&amp;lt;/code&amp;gt;. Esta tabla es optativa y en caso de no existir, utilizara el valor &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32 y permitiendo volteo vertical:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
YDisplacements:&lt;br /&gt;
Pose32x32_YDisp:&lt;br /&gt;
    db $00,$00,$10,$10&lt;br /&gt;
Pose32x32_YDispFlipY:&lt;br /&gt;
    db $10,$10,$00,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Sizes&#039;&#039;&#039;: Es una tabla que indica el tamaño de cada uno de los tiles que se utiliza, cada valor es &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; para tiles de 8x8 y &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; para tiles de 16x16. Contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; y la segunda línea es un valor por cada tile de la pose indicando el tamaño de cada tile. Esta tabla es optativa y en caso de no existir, utilizara el valor &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Sizes:&lt;br /&gt;
Pose32x32_Sizes:&lt;br /&gt;
    db $02,$02,$02,$02&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Properties&#039;&#039;&#039;: Es una tabla que indica las propiedades de cada tile, las propiedades siguen el formato YXCCPPPT, donde X es si el tile es volteado horizontalmente, Y es si el tile es volteado verticalmente, CC es la prioridad con respecto al layer 1 y layer 2, donde 00 es la prioridad más baja y 11 es la más alta, CCC es la paleta de colores usada por el tile y T es 1 para usar SP3/SP4 y 0 para SP1/SP2. Contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; y la segunda línea es un valor por cada tile de la pose indicando la propiedad de cada tile. Esta tabla es optativa y en caso de no existir, utilizara el valor que se entregue en el &amp;lt;code&amp;gt;!PropParam&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Properties:&lt;br /&gt;
Pose32x32_Properties:&lt;br /&gt;
    db $20,$20,$20,$20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Palette Effect ===&lt;br /&gt;
Los archivos con extensión &amp;quot;.paleffect&amp;quot; son archivos json que se utilizan para múltiples efectos de paletas de colores, tanto globales como normales, estos archivos pueden ser creados utilizando el tool &amp;quot;Palette Effect Creator&amp;quot; que es incluido al Dynamic X.&lt;br /&gt;
El formato de estos archivos es el siguiente:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;Name&amp;quot;: ...,&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [...]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Name&#039;&#039;&#039;: Es el nombre del conjunto de efectos de paletas de colores. Ejemplo:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Name&amp;quot;: &amp;quot;DecreaseSaturation&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Effects&#039;&#039;&#039;: Es una lista con cada uno de los efectos de paletas de colores, estos tienen 7 parámetros, los primeros 3 son Channel1, Channel2 y Channel3 que son valores entre 0 y 31 que indican el valor de cada canal, en el caso de un efecto RGB, el Channel1 es R, el Channel2 es G y el channel3 es B, en el caso de un efecto HSL, el Channel1 es H, el Channel2 es S y el Channel3 es L, luego vienen 3 valores más, el Ratio1, Ratio2 y Ratio3, cada uno de estos es un número entre 0 y 31 indicando cuanto afecta cada Channel a los colores de la paleta de colores, donde 0 es que afecta en un 0% y 31 es que afecta en un 100%, por ultimo Channels es para indicar si es un efecto RGB o HSL, 0 es RGB y 1 es HSL. El sguiente ejemplo muestra 2 efectos HSL que disminuyen la saturación:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 30,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 31,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modo de Uso ==&lt;br /&gt;
=== Carga Dinámica de Poses ===&lt;br /&gt;
==== Cambiar Configuración de Espacio para Poses Dinámicas ====&lt;br /&gt;
&lt;br /&gt;
=== Dibujar Poses ===&lt;br /&gt;
=== Carga y Dibujo de Poses en Sprites ===&lt;br /&gt;
Los sprites (Sprites normales, clusters y extended) poseen rutinas especiales que se insertan en las Shared Routines de Pixi al momento de instalar el Dynamic X, estas rutinas simplifican considerablemente el trabajar con poses dinámicas y con el sistema de dibujo del Dinamic X.&lt;br /&gt;
==== Upload ====&lt;br /&gt;
La primera rutina es &#039;&#039;&#039;Upload&#039;&#039;&#039;, esta rutina carga en el espacio destinado para poses Dinámicas, la pose que deseas. Posee 2 versiones el &#039;&#039;&#039;Upload&#039;&#039;&#039; normal y el &#039;&#039;&#039;UploadWithoutPoseOffset&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Upload&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Versiones&#039;&#039;&#039;: %DXNormalUpload(), %DXClusterUpload(), %DXExtendedUpload().&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Input&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A&#039;&#039;&#039;: ID de la pose base (16 bits). Se puede usar el define autogenerado por Dynamic X que es &amp;lt;code&amp;gt;!DynamicPoseID&amp;lt;Nombre del Dynamic Info&amp;gt;000&amp;lt;/code&amp;gt;. Ejemplo: &amp;lt;code&amp;gt;!DynamicPoseIDDKCKlaptrap000&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;!PoseIndex,x&#039;&#039;&#039;: La pose dentro del contexto que se desea cargar. Se calcula la pose como &amp;lt;code&amp;gt;A + !PoseIndex,x&amp;lt;/code&amp;gt;. Por ejemplo si deseamos la pose 5 de Klaptrap en A se pondria &amp;lt;code&amp;gt;!DynamicPoseIDDKCKlaptrap000&amp;lt;/code&amp;gt; y en &amp;lt;code&amp;gt;!PoseIndex,x&amp;lt;/code&amp;gt; pondriamos el valor &amp;lt;code&amp;gt;$05&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Output&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Carry&#039;&#039;&#039;: Si despues de la rutina hay un Carry Set, puede significar 3 cosas:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
La pose fue cargada con éxito.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
La pose ya estaba cargada previamente y se esta reutilizando.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
La pose no fue cargada y no fue encontrada, pero en un ciclo anterior si se cargo una pose en la VRAM y se puede usar.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Si el Carry es un Carry Clear, la pose no pudo ser cargada y previamente no se cargo ninguna pose, en este caso lo recomendable seria despawnear el sprite, excepto si es un Boss o un sprite que debe ser persistente en el nivel. &lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;!LastPoseIndex,x&#039;&#039;&#039;: Tendrá el valor de la ultima pose que fue cargada a la VRAM. Al momento de dibujar o de hacer una rutina de interacción que tenga cajas de colisión dependientes de la pose, se debería utilizar esta tabla. Si es &amp;lt;code&amp;gt;$FF&amp;lt;/code&amp;gt; entonces nunca se ha cargado una pose previamente.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;!LastPoseHashIndex,x&#039;&#039;&#039;: Es de uso interno, pero básicamente contendrá el valor del ID que indexa la tabla hash de poses de la ultima pose que fue cargada. Si es &amp;lt;code&amp;gt;$FF&amp;lt;/code&amp;gt; entonces nunca se ha cargado una pose previamente.  Si es &amp;lt;code&amp;gt;$FF&amp;lt;/code&amp;gt; entonces nunca se ha cargado una pose previamente.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;!LastFlip,x&#039;&#039;&#039;: Es el valor de &amp;lt;code&amp;gt;!GlobalFlip,x XOR !LocalFlip,x&amp;lt;/code&amp;gt; que tenia la ultima pose que fue cargada. Al momento de dibujar o de hacer una rutina de interacción que tenga cajas de colisión dependientes de la pose, se debería utilizar esta tabla. Si es &amp;lt;code&amp;gt;$FF&amp;lt;/code&amp;gt; entonces nunca se ha cargado una pose previamente.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;$04&#039;&#039;&#039;: Tendra el valor &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; si el primer tile de la pose esta cargado en SP1 o SP2, o &amp;lt;code&amp;gt;$01&amp;lt;/code&amp;gt; si el primer tile de la pose fue cargado en SP3 o SP4.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;$08&#039;&#039;&#039;: Tiene el Offset del primer Tile que se cargo en la pose.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;UploadWithoutPoseOffset&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Versiones&#039;&#039;&#039;: %DXNormalUploadWithoutPoseOffset(), %DXClusterUploadWithoutPoseOffset(), %DXExtendedUploadWithoutPoseOffset().&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Input&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A&#039;&#039;&#039;: ID de la pose deseada (16 bits). Puedes utilizar los defines autogenerados por Dynamic X para la pose que inician con &amp;lt;code&amp;gt;!DynamicPoseID&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Outputs&#039;&#039;&#039;: Los mismos de &#039;&#039;&#039;Upload&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
==== Draw ====&lt;br /&gt;
La segunda rutina es &#039;&#039;&#039;Draw&#039;&#039;&#039;, esta rutina se encarga de dibujar una pose, puede recibir ciertos parámetros para cambiar las propiedades, la posición o la prioridad de la pose. Tiene 2 versiones distintas &#039;&#039;&#039;Draw&#039;&#039;&#039; y &#039;&#039;&#039;DrawWithOffset&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Draw&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Versiones&#039;&#039;&#039;: %DXNormalDraw(), %DXClusterDraw(), %DXExtendedDraw()&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Inputs&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DrawWithOffset&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Versiones&#039;&#039;&#039;: %DXNormalDrawWithOffset(), %DXClusterDrawWithOffset(), %DXExtendedDrawWithOffset()&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Carga de Gráficos ===&lt;br /&gt;
=== Carga de Paletas ===&lt;br /&gt;
=== Paletas de Sprites ===&lt;br /&gt;
==== Asignación de Paletas ====&lt;br /&gt;
===== Restringir Sobre escritura de Paletas =====&lt;br /&gt;
&lt;br /&gt;
=== Efectos de paletas ===&lt;br /&gt;
=== Cambiar Gráficos del Player usando un GFX similar al GFX32 ===&lt;br /&gt;
=== Cambiar Gráficos del Player ===&lt;br /&gt;
=== Cambiar Paleta del Player ===&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15115</id>
		<title>Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15115"/>
		<updated>2024-01-20T00:16:37Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Draw Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X is an advanced dynamic load management system whose purpose is to support the transfer of graphics and color palettes to the VRAM and CGRAM respectively. This system would replace Dynamic Z V3.7 which in turn is a replacement for DSX.&lt;br /&gt;
== Download ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
= Features =&lt;br /&gt;
*Load Poses Dynamically: Allows to load poses for Dynamic Sprites from any ASM code.&lt;br /&gt;
*Draw Poses: Allows to draw any pose that is registered in the system anywhere on the screen and from any ASM code. The way of drawing is totally optimized for each pose, basically all the poses that have similar characteristics, use the same graphic routine to optimize cycles and to make it as efficient as possible, besides diminishing considerably the amount of ROM used in graphic routines, since, 1 graphic routine can draw hundreds of different poses that belong to different Sprites.&lt;br /&gt;
*Load Graphics to VRAM.&lt;br /&gt;
*Load Color Palettes to the CGRAM.&lt;br /&gt;
*Automatic Palette Assignment: When a Sprite loads a palette, it can ask the system to assign a palette in an automated way, it will look for a free palette and it can be used by the Sprite, in case the palette is already loaded in the loaded CGRAM then it will give the Sprite that palette. The system informs if there are no palettes available, this way, you can avoid that the Sprite tries to work with wrong palettes.&lt;br /&gt;
*Color Palette Effects: You can edit the palettes that are loaded to change attributes such as Hue, Saturation and Brightness, you can weight them with a preset color or de-power certain RGB or HSL channels.&lt;br /&gt;
*Registration of Graphics and Palettes: The system allows you to insert graphics and palettes in the ROM, when you do so, the position in which they were saved in the ROM are available and you can also know the ID with which it was registered in the system, you can use that ID to dynamically load those graphics. Dynamic X will take care of deleting the graphics and palettes previously saved by the system and insert the new graphics and palettes in a free place in the ROM.&lt;br /&gt;
== Features that may have compatibility issues ==&lt;br /&gt;
*Custom Player Graphics: Dynamic X allows you to either change the player graphics using an EXGFX similar to GFX32 being limited to use the size and number of poses of the Vanilla game or simply disable completely the dynamic loading of player graphics, yoshi or podoboos to make your own dynamic routine for a custom player without limitations of size or number of poses. This feature allows you to change the graphics at any time, so you could use different players in different levels or in different areas of the same level.&lt;br /&gt;
*Player Custom Palettes: Dynamic X allows you to change the player&#039;s color palette freely.&lt;br /&gt;
*Player DMA optimizations: Dynamic X decreases considerably the cycles used by the NMI handler, since, the player graphics, yoshi and podoboos are only loaded in the VRAM when they are required, not always as it happens in the Vanilla game. This also leaves you some extra tiles in SP1 in levels that don&#039;t use yoshi or podoboos, even an extra tile in levels that don&#039;t use the layer.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
= Installation =&lt;br /&gt;
== General Steps ==&lt;br /&gt;
Before installing Dynamic X.&lt;br /&gt;
# The ROM must have SA-1 Pack installed.&lt;br /&gt;
# Put all files with &amp;quot;.drawinfo&amp;quot; extension in the &amp;quot;DrawInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.dynamicinfo&amp;quot; extension in the &amp;quot;DynamicInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.paleffect&amp;quot; extension in the &amp;quot;PaletteEffects&amp;quot; folder.&lt;br /&gt;
# Put all resource files such as GFXs and Color Palettes with &amp;quot;.bin&amp;quot; extension in the &amp;quot;DynamicResources&amp;quot; folder.&lt;br /&gt;
== Using the Tool Directly ==&lt;br /&gt;
You can install Dynamic X by opening the file &amp;quot;DynamicXTool.exe&amp;quot;, it will open a console telling you what to type at any given moment. It will start asking you for the ROM paths, Pixi folder, UberasmTool or GPS (these last 3 are optional) and then it will ask you for the features you want to install, put &amp;quot;y&amp;quot; or &amp;quot;yes&amp;quot; to enable each feature and &amp;quot;n&amp;quot; or &amp;quot;no&amp;quot; to disable that feature.&lt;br /&gt;
Warning: Features such as Player Features and Status Bar Optimization, may have incompatibilities with other resources, so you should be careful when installing them. Be careful which features you install.&lt;br /&gt;
&lt;br /&gt;
== Using the Tool From Console ==&lt;br /&gt;
You must call the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ROM will install with the default settings if you have never done a previous installation, if you have done a previous installation, then the settings used in that installation will be used.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
In case you want to change the settings manually you must open the settings.json file that will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must change the parameters according to the settings you want.&lt;br /&gt;
= Formats =&lt;br /&gt;
== Dynamic Info ==&lt;br /&gt;
Files with extension &amp;quot;.dynamicinfo&amp;quot; are used to insert pose graphics, palettes and other resources into the ROM. They also include the information necessary for the poses to be loaded correctly into the VRAM.&lt;br /&gt;
&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Below this label goes each graphics file used to load dynamic poses. Example: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Below this label goes each color palette file used for dynamic poses. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesSizes&#039;&#039;&#039;&#039;: Below this file goes 2 lines for each pose, the first line is a label describing the pose and the second line is 2 values, each of these values indicates how many 8x8 tiles are used in each chunk, each dynamic pose has 2 chunks of data generally (except some exceptions that may require only 1 chunk), the top chunk and the bottom chunk. The top chunk is all the 8x8 tiles that are before the last 8 pixels high line, while the bottom chunk is the last line. In the following example you can see 3 images, the left one is how the assembled image should look like, the second one is how it would look like in the VRAM and the third one is how it would be saved in the binary file, it would also show how the poses sizes of that pose are, which in this case would be 8 tiles of the top chunk and 8 tiles of the bottom chunk:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: For poses whose number of 8x8 tiles is divisible by 32, you can use only the top chunk that has all the tiles and the bottom chunk would be 0.&lt;br /&gt;
&lt;br /&gt;
== Draw Info ==&lt;br /&gt;
The files with extension &amp;quot;.drawinfo&amp;quot;, have the necessary information to draw poses, these poses can be dynamic or static poses. Dynamic X uses these files to generate optimized graphic routines for each pose, the tool detects if one of the tables is necessary or not, eliminates redundant data, pigeonholes each pose in a group that shares similar characteristics and then inserts a graphic routine for each group of poses that share similar characteristics.&lt;br /&gt;
The file format is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: If true it is dynamic, if false it is static, example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: It is a table that indicates which tiles each pose uses, in the case of the dynamic poses it must be considered that the tile of more superior to the left is the tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, this table contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; and the second line would be each one of the tiles used by the pose This table is optional and in case it is not, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the tiles of the pose.This table is optional and in case it is not present, it will use the value $00 for the tiles of the pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: It is a table that indicates the horizontal displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move horizontally each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped horizontally, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping. The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;YDisplacements&#039;&#039;&#039;: It is a table that indicates the vertical displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_YDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move vertically each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped vertically, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_YDispFlipY:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping. The following example draws 4 tiles forming a 32x32 pose and allowing vertical flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
YDisplacements:&lt;br /&gt;
Pose32x32_YDisp:&lt;br /&gt;
    db $00,$00,$10,$10&lt;br /&gt;
Pose32x32_YDispFlipY:&lt;br /&gt;
    db $10,$10,$00,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Sizes&#039;&#039;&#039;: Is a table indicating the size of each tile used, each value is &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for 8x8 tiles and &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for 16x16 tiles. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the size of each tile. This table is optional and in case it does not exist, it will use the value &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Sizes:&lt;br /&gt;
Pose32x32_Sizes:&lt;br /&gt;
    db $02,$02,$02,$02&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Properties&#039;&#039;&#039;: Is a table indicating the properties of each tile, the properties follow the format YXCCPPPT, where X is if the tile is flipped horizontally, Y is if the tile is flipped vertically, CC is the priority with respect to layer 1 and layer 2, where 00 is the lowest priority and 11 is the highest, CCC is the color palette used by the tile and T is 1 for using SP3/SP4 and 0 for SP1/SP2. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the property of each tile. This table is optional and in case it does not exist, it will use the value given in the &amp;lt;code&amp;gt;!PropParam&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Properties:&lt;br /&gt;
Pose32x32_Properties:&lt;br /&gt;
    db $20,$20,$20,$20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=es/Dynamic_X&amp;diff=15114</id>
		<title>es/Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=es/Dynamic_X&amp;diff=15114"/>
		<updated>2024-01-20T00:14:10Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Draw Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X es un sistema avanzado de manejo de carga dinámica cuyo propósito es otorgar soporte a la transferencia de gráficos y paletas de colores a la VRAM y CGRAM respectivamente. Este sistema vendría a reemplazar al Dynamic Z V3.7 que a su ves es un reemplazo del DSX.&lt;br /&gt;
== Descarga ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
== Funcionalidades ==&lt;br /&gt;
* Cargar Poses Dinámicamente: Permite cargar poses para Sprites Dinámicos desde cualquier código ASM.&lt;br /&gt;
* Dibujar Poses: Permite dibujar cualquier pose que este registrada en el sistema en cualquier lugar de la pantalla y desde cualquier código ASM. La forma de dibujar esta totalmente optimizada para cada pose, básicamente todas las poses que tienen características similares, usan la misma rutina grafica para optimizar ciclos y que sea lo más eficiente posible, además de disminuir considerablemente la cantidad de ROM utilizada en rutinas graficas, ya que, 1 rutina grafica puede dibujar cientos de poses distintas que pertenecen a distintos Sprites.&lt;br /&gt;
* Cargar Gráficos a la VRAM.&lt;br /&gt;
* Cargar Paletas de Colores a la CGRAM.&lt;br /&gt;
* Asignación Automática de Paletas: Cuando un Sprite carga una paleta, puede pedir al sistema que le asigne una paleta de forma automatizada, este buscara una paleta libre y podrá ser usada por el Sprite, en caso que la paleta ya este cargada en la CGRAM cargada entonces le dará al Sprite esa paleta. El sistema informa si no hay paletas disponibles, de esta manera, se puede evitar que el Sprite intente funcionar con paletas erróneas.&lt;br /&gt;
* Efectos de Paletas de Colores: Se puede editar las paletas que están cargadas para que cambien atributos como el Hue (Tinte), la Saturación y el Brillo, se pueden ponderar con un color preestablecido o también quitarle potencia a ciertos canales RGB o HSL.&lt;br /&gt;
* Registro de Gráficos y Paletas: El sistema permite insertar gráficos y paletas en el ROM, al hacerlo quedan disponibles la posición en que fueron guardados en el ROM y además puedes saber el ID con que fue registrado en el sistema, puedes utilizar ese ID para cargar dinámicamente esos gráficos. Dynamic X se hará cargo de eliminar los gráficos y paletas guardados previamente por el sistema e insertar los nuevos gráficos y paletas en un lugar libre en la ROM.&lt;br /&gt;
=== Funcionalidades que pueden tener problemas de compatibilidad ===&lt;br /&gt;
* Gráficos Custom para el Player: Dynamic X permite tanto cambiar los gráficos del player usando un EXGFX similar al GFX32 estando limitado a que use el tamaño y la cantidad de poses del juego Vanilla o simplemente deshabilitar completamente la carga dinámica de gráficos del player, yoshi o podoboos para hacer tu propia rutina dinámica para un player custom sin limitaciones de tamaño o cantidad de poses. Esta funcionalidad permite cambiar los gráficos en cualquier momento, por lo que podrías usar distintos players en distintos niveles o en distintas zonas del mismo nivel.&lt;br /&gt;
* Paletas Custom para el Player: Dynamic X te permite cambiar la paleta de colores del player libremente.&lt;br /&gt;
* Optimizaciones del DMA del Player: Dynamic X disminuye considerablemente los ciclos utilizados por el NMI handler, ya que, los gráficos del player, yoshi y podoboos solo son cargados en la VRAM cuando son requeridos, no siempre como ocurre en el juego Vanilla. Esto además te deja algunos tiles extras en el SP1 en niveles que no utilicen a yoshi o podoboos, incluso un tile extra en niveles que no usen la capa.&lt;br /&gt;
&lt;br /&gt;
== Requisitos ==&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
&lt;br /&gt;
== Instalación ==&lt;br /&gt;
=== Pasos Generales ===&lt;br /&gt;
Antes de instalar el Dynamic X.&lt;br /&gt;
# El ROM debe tener instalado SA-1 Pack.&lt;br /&gt;
# Poner todos los archivos con extensión &amp;quot;.drawinfo&amp;quot; en la carpeta &amp;quot;DrawInfo&amp;quot;.&lt;br /&gt;
# Poner todos los archivos con extensión &amp;quot;.dynamicinfo&amp;quot; en la carpeta &amp;quot;DynamicInfo&amp;quot;.&lt;br /&gt;
# Poner todos los archivos con extension &amp;quot;.paleffect&amp;quot; en la carpeta &amp;quot;PaletteEffects&amp;quot;.&lt;br /&gt;
# Poner todos los archivos de recursos como GFXs y Paletas de colores que tienen extension &amp;quot;.bin&amp;quot; en la carpeta &amp;quot;DynamicResources&amp;quot;.&lt;br /&gt;
==== Usando el Tool Directamente ====&lt;br /&gt;
Puedes instalar el Dynamic X dándole abriendo el archivo &amp;quot;DynamicXTool.exe&amp;quot;, al hacerlo se te abrirá una consola diciéndote que escribir en cada momento. Iniciara preguntandote por los paths del ROM, carpeta de Pixi, UberasmTool o GPS (estos ultimos 3 son optativos) y luego te preguntara por los features que quieres instalar, pon &amp;quot;y&amp;quot; o &amp;quot;yes&amp;quot; para habilitar cada feature y &amp;quot;n&amp;quot; o &amp;quot;no para deshabilitar ese feature.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Advertencia&#039;&#039;&#039;: Los features como Player Features y Status Bar Optimization, pueden tener incompatibilidades con otros recursos, así que debes tener cuidado al instalarlos. Tener cuidado con que features instalan.&lt;br /&gt;
&lt;br /&gt;
==== Usando el Tool Desde Consola ====&lt;br /&gt;
Debes llamar el comando:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
El ROM se instalara con los settings default si nunca se ha hecho una instalación previa, si se ha hecho una instalación previa, entonces se usaran los settings usados en esa instalación.&lt;br /&gt;
&lt;br /&gt;
===== Settings =====&lt;br /&gt;
En caso de querer cambiar los settings manualmente debes abrir el archivo settings.json que se vera así:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Debes cambiar los parámetros según los settings que desees.&lt;br /&gt;
&lt;br /&gt;
== Mejoras en Comparación a otros sistemas ==&lt;br /&gt;
=== Dynamic X VS DSX ===&lt;br /&gt;
* Dynamic X contiene muchos features que DSX no posee. El DSX solo posee soporte para sprites dinámicos. Por favor ver capitulo [https://sneslab.net/mw/index.php?title=es/Dynamic_X&amp;amp;action=edit&amp;amp;section=1 Funcionalidades].&lt;br /&gt;
* DSX permite máximo 4 sprites dinámicos de 32x32, 2 de 48x48 o 1 de 64x64. Dynamic X tiene menos limitaciones en el número de sprites, primero por que todos los sprites comparten poses, por lo tanto, si hay 2 sprites iguales es muy probable que puedas usar todos los que quieras en pantalla sin problemas, segundo puedes decirle al Dynamic X que espacio dinámico usar y dependiendo de ese espacio tienes más o menos limite para sprites dinámicos, de hecho, no existe un limite para sprites dinámicos como tal debido a que si un sprite no puede cargar una pose en la vram, usa la ultima pose que logro cargar, por lo tanto, en el peor de los casos el sprite quedaría con su pose congelada por un momento hasta que sea capaz de cargar una nueva pose.&lt;br /&gt;
* DSX requiere copiar una rutina a todos los sprites que usan su sistema, Dynamic X es solo llamar una rutina de la API, en 3 lineas de codigo puedes subir una pose a la VRAM y dibujar esa pose, eso hace al Dynamic X mucho más eficiente en ROM.&lt;br /&gt;
* DSX no tiene sistema de dibujado, el sprite debe tener su propia rutina gráfica, lo que no solo hace que cada pose dinámica sea solo utilizable dentro del contexto del sprite, sino que gasta mucha más ROM al tener que hacer esa rutina gráfica. Dynamic X por otro lado, permite cargar cualquier pose dinámica y dibujarla desde cualquier código ASM, lo que le da mucha más flexibilidad de uso y además al tener un sistema centralizado de dibujo, se ahorra mucho espacio en ROM.&lt;br /&gt;
* El DSX permite como máximo, cargar poses dinámicas de 64x64 (16 tiles de 16x16), Dynamic X no tiene un limite, si puedes optimizar el NMI handler podrías teóricamente hacer poses de hasta 96x96 (32~36 tiles de 16x16), aunque sin optimizaciones fuertes y solo desactivando las exanimations vanilla, podrías conseguir un sprite 80x80 (24~25 tiles de 16x16).&lt;br /&gt;
* Los gráficos del Dynamic X, son optimizados, esto significa que a pesar de no estar comprimidos con algoritmos como LZ, si usan la menor cantidad de tiles de 16x16 y 8x8 posibles, por lo tanto, esto permite utilizar sprites más grandes y optimizar las transferencias a la VRAM, lo que aumenta su capacidad de tener más poses dinámicas cargadas en la VRAM. El DSX por su parte, los gráficos no tienen ningún tipo de optimización y suelen malgastar mucho espacio con zonas en blanco.&lt;br /&gt;
* El DSX usa un buffer que luego es enviado a la VRAM, esto es un problema debido a que generar ese buffer es muy lento y requiere muchos ciclos, además el DSX debe generar este buffer en cada frame, por lo que un sprite dinámico hecho para DSX suele ser muy lento y utilizar muchos recursos, incluso utilizando SA-1 podrías tener problemas de slowdown si utilizas sprites dinámicos y algún efecto de hdma que sea complejo como un parallax o un wave. El Dynamic X no utiliza un buffer, si no que usa cola de transferencias que se carga directamente a la VRAM sin buffers intermedios, no solo eso, sino que cada pose es cargada solo cuando es necesario, por lo tanto, la carga no se hace en cada frame, sino cuando es necesario, además en ciertos sprites puedes sincronizar la animación para que todos usen exactamente la misma pose o una pose que ya esta cargada en la VRAM, esto reduce considerablemente el slowdown.&lt;br /&gt;
&lt;br /&gt;
=== Dynamic X VS Dynamic Z V3.7 ===&lt;br /&gt;
&lt;br /&gt;
== Formatos ==&lt;br /&gt;
=== Dynamic Info ===&lt;br /&gt;
Los archivos con extensión &amp;quot;.dynamicinfo&amp;quot; se utilizan para insertar gráficos de poses, paletas y otros recursos en el ROM. Además incluyen la información necesaria para que las poses sean cargadas correctamente en la VRAM.&lt;br /&gt;
&lt;br /&gt;
El formato de estos archivos es el siguiente:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Debajo de este label va cada archivo de gráficos utilizado para cargar poses dinámicas. Ejemplo: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Debajo de este label va cada archivo de paletas de colores utilizado para las poses dinámicas. Ejemplo: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Resources&#039;&#039;&#039;: Debajo de este label va cada archivo extra que se utilice como recurso y que se desee insertar en el ROM. Ejemplo: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Resources:&lt;br /&gt;
    Geno.bin&lt;br /&gt;
    GenoPal.bin&lt;br /&gt;
    FireGenoPal.bin&lt;br /&gt;
    GenoPalPlayer2.bin&lt;br /&gt;
    FireGenoPalPlayer2.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesSizes&#039;&#039;&#039;: Debajo de este archivo van 2 líneas por cada pose, la primera linea es un label que describe la pose y la segunda linea son 2 valores, cada uno de estos valores indica cuantos tiles de 8x8 se usan en cada chunk, cada pose dinámica tiene 2 chunks de data generalmente (excepto algunas excepciones que pueden requerir solo 1 chunk), el chunk de arriba y el chunk de abajo. El chunk de arriba son todos los tiles de 8x8 que están antes de la ultima linea de 8 pixeles de alto, mientras que el chunk de abajo es la ultima linea. En el siguiente ejemplo se pueden ver 3 imagenes, la de la izquierda es como deberia verse la imagen ensamblada, la segunda es como se veria en la VRAM y la tercera es como estaria guardado en el archivo binario, tambien mostraria como son los poses sizes de esa pose, que en este caso serian 8 tiles del chunk de arriba y 8 tiles del chunk de abajo:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Nota: Para poses cuyo número de tiles de 8x8 sea divisible por 32, se puede usar solo el chunk de arriba que tiene todos los tiles y el chunk de abajo quedaria en 0.&lt;br /&gt;
&lt;br /&gt;
=== Draw Info ===&lt;br /&gt;
Los archivos con extensión &amp;quot;.drawinfo&amp;quot;, tienen la información necesaria para dibujar poses, estas poses pueden ser dinámicas o poses estáticas. El Dynamic X utiliza estos archivos para generar rutinas gráficas optimizadas para cada pose, el tool detecta si es necesaria o no una de las tablas, elimina data redundante o que no aporta, encasilla cada pose en un grupo que comparte características similares y luego inserta una rutina gráfica por cada grupo de poses que comparten características similares.&lt;br /&gt;
El formato del archivo es el siguiente:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: Si es true es dinámica, si es false es estatica, ejemplo:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: Es una tabla que indica que tiles utiliza cada pose, en el caso de las poses dinámicas debe considerarse que el tile de más arriba a la izquierda es el tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, esta tabla contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; y la segunda línea seria cada uno de los tiles utilizado por la pose. Esta tabla es optativa y en caso de que no este, utilizara el valor &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: Es una tabla que indica el desplazamiento horizontal de cada tile con respecto a la posición de la pose y contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code&amp;gt; y la segunda línea es un valor por cada tile de la pose indicando cuanto debe moverse horizontalmente cada tile con respecto a la posición de la pose, adicionalmente se pueden añadir 2 líneas más por cada pose para cuando la pose es volteada horizontalmente, el formato es el mismo de las 2 líneas anteriores solo que la primera línea es &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code&amp;gt;. Esta tabla es optativa y en caso de no existir, utilizara el valor &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32 y permitiendo volteo horizontal:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;YDisplacements&#039;&#039;&#039;: Es una tabla que indica el desplazamiento vertical de cada tile con respecto a la posición de la pose y contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_YDisp:&amp;lt;/code&amp;gt; y la segunda línea es un valor por cada tile de la pose indicando cuanto debe moverse verticalmente cada tile con respecto a la posición de la pose, adicionalmente se pueden añadir 2 líneas más por cada pose para cuando la pose es volteada verticalmente, el formato es el mismo de las 2 líneas anteriores solo que la primera línea es &amp;lt;code&amp;gt;PoseName_YDispFlipY:&amp;lt;/code&amp;gt;. Esta tabla es optativa y en caso de no existir, utilizara el valor &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32 y permitiendo volteo vertical:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
YDisplacements:&lt;br /&gt;
Pose32x32_YDisp:&lt;br /&gt;
    db $00,$00,$10,$10&lt;br /&gt;
Pose32x32_YDispFlipY:&lt;br /&gt;
    db $10,$10,$00,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Sizes&#039;&#039;&#039;: Es una tabla que indica el tamaño de cada uno de los tiles que se utiliza, cada valor es &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; para tiles de 8x8 y &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; para tiles de 16x16. Contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; y la segunda línea es un valor por cada tile de la pose indicando el tamaño de cada tile. Esta tabla es optativa y en caso de no existir, utilizara el valor &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Sizes:&lt;br /&gt;
Pose32x32_Sizes:&lt;br /&gt;
    db $02,$02,$02,$02&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Properties&#039;&#039;&#039;: Es una tabla que indica las propiedades de cada tile, las propiedades siguen el formato YXCCPPPT, donde X es si el tile es volteado horizontalmente, Y es si el tile es volteado verticalmente, CC es la prioridad con respecto al layer 1 y layer 2, donde 00 es la prioridad más baja y 11 es la más alta, CCC es la paleta de colores usada por el tile y T es 1 para usar SP3/SP4 y 0 para SP1/SP2. Contiene 2 líneas por cada pose, la primera línea es &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; y la segunda línea es un valor por cada tile de la pose indicando la propiedad de cada tile. Esta tabla es optativa y en caso de no existir, utilizara el valor que se entregue en el &amp;lt;code&amp;gt;!PropParam&amp;lt;/code&amp;gt; para los tiles de la pose. El siguiente ejemplo dibuja 4 tiles formando una pose de 32x32:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Properties:&lt;br /&gt;
Pose32x32_Properties:&lt;br /&gt;
    db $20,$20,$20,$20&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Sizes&#039;&#039;&#039;: Is a table indicating the size of each tile used, each value is &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for 8x8 tiles and &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for 16x16 tiles. It contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Sizes:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating the size of each tile. This table is optional and in case it does not exist, it will use the value &amp;lt;code&amp;gt;$02&amp;lt;/code&amp;gt; for the pose tiles. The following example draws 4 tiles forming a 32x32 pose:&lt;br /&gt;
&lt;br /&gt;
=== Palette Effect ===&lt;br /&gt;
Los archivos con extensión &amp;quot;.paleffect&amp;quot; son archivos json que se utilizan para múltiples efectos de paletas de colores, tanto globales como normales, estos archivos pueden ser creados utilizando el tool &amp;quot;Palette Effect Creator&amp;quot; que es incluido al Dynamic X.&lt;br /&gt;
El formato de estos archivos es el siguiente:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;Name&amp;quot;: ...,&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [...]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Name&#039;&#039;&#039;: Es el nombre del conjunto de efectos de paletas de colores. Ejemplo:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Name&amp;quot;: &amp;quot;DecreaseSaturation&amp;quot;,&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Effects&#039;&#039;&#039;: Es una lista con cada uno de los efectos de paletas de colores, estos tienen 7 parámetros, los primeros 3 son Channel1, Channel2 y Channel3 que son valores entre 0 y 31 que indican el valor de cada canal, en el caso de un efecto RGB, el Channel1 es R, el Channel2 es G y el channel3 es B, en el caso de un efecto HSL, el Channel1 es H, el Channel2 es S y el Channel3 es L, luego vienen 3 valores más, el Ratio1, Ratio2 y Ratio3, cada uno de estos es un número entre 0 y 31 indicando cuanto afecta cada Channel a los colores de la paleta de colores, donde 0 es que afecta en un 0% y 31 es que afecta en un 100%, por ultimo Channels es para indicar si es un efecto RGB o HSL, 0 es RGB y 1 es HSL. El sguiente ejemplo muestra 2 efectos HSL que disminuyen la saturación:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;Effects&amp;quot;: [&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 30,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;Channel1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel2&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channel3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio1&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Ratio2&amp;quot;: 31,&lt;br /&gt;
      &amp;quot;Ratio3&amp;quot;: 0,&lt;br /&gt;
      &amp;quot;Channels&amp;quot;: 1&lt;br /&gt;
    }&lt;br /&gt;
  ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modo de Uso ==&lt;br /&gt;
=== Carga Dinámica de Poses ===&lt;br /&gt;
==== Cambiar Configuración de Espacio para Poses Dinámicas ====&lt;br /&gt;
&lt;br /&gt;
=== Dibujar Poses ===&lt;br /&gt;
=== Carga y Dibujo de Poses en Sprites ===&lt;br /&gt;
Los sprites (Sprites normales, clusters y extended) poseen rutinas especiales que se insertan en las Shared Routines de Pixi al momento de instalar el Dynamic X, estas rutinas simplifican considerablemente el trabajar con poses dinámicas y con el sistema de dibujo del Dinamic X.&lt;br /&gt;
==== Upload ====&lt;br /&gt;
La primera rutina es &#039;&#039;&#039;Upload&#039;&#039;&#039;, esta rutina carga en el espacio destinado para poses Dinámicas, la pose que deseas. Posee 2 versiones el &#039;&#039;&#039;Upload&#039;&#039;&#039; normal y el &#039;&#039;&#039;UploadWithoutPoseOffset&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Upload&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Versiones&#039;&#039;&#039;: %DXNormalUpload(), %DXClusterUpload(), %DXExtendedUpload().&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Input&#039;&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A&#039;&#039;&#039;: ID de la pose base (16 bits). Se puede usar el define autogenerado por Dynamic X que es &amp;lt;code&amp;gt;!DynamicPoseID&amp;lt;Nombre del Dynamic Info&amp;gt;000&amp;lt;/code&amp;gt;. Ejemplo: &amp;lt;code&amp;gt;!DynamicPoseIDDKCKlaptrap000&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;!PoseIndex,x&#039;&#039;&#039;: La pose dentro del contexto que se desea cargar. Se calcula la pose como &amp;lt;code&amp;gt;A + !PoseIndex,x&amp;lt;/code&amp;gt;. Por ejemplo si deseamos la pose 5 de Klaptrap en A se pondria &amp;lt;code&amp;gt;!DynamicPoseIDDKCKlaptrap000&amp;lt;/code&amp;gt; y en &amp;lt;code&amp;gt;!PoseIndex,x&amp;lt;/code&amp;gt; pondriamos el valor &amp;lt;code&amp;gt;$05&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Output&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Carry&#039;&#039;&#039;: Si despues de la rutina hay un Carry Set, puede significar 3 cosas:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
La pose fue cargada con éxito.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
La pose ya estaba cargada previamente y se esta reutilizando.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
La pose no fue cargada y no fue encontrada, pero en un ciclo anterior si se cargo una pose en la VRAM y se puede usar.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Si el Carry es un Carry Clear, la pose no pudo ser cargada y previamente no se cargo ninguna pose, en este caso lo recomendable seria despawnear el sprite, excepto si es un Boss o un sprite que debe ser persistente en el nivel. &lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;!LastPoseIndex,x&#039;&#039;&#039;: Tendrá el valor de la ultima pose que fue cargada a la VRAM. Al momento de dibujar o de hacer una rutina de interacción que tenga cajas de colisión dependientes de la pose, se debería utilizar esta tabla. Si es &amp;lt;code&amp;gt;$FF&amp;lt;/code&amp;gt; entonces nunca se ha cargado una pose previamente.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;!LastPoseHashIndex,x&#039;&#039;&#039;: Es de uso interno, pero básicamente contendrá el valor del ID que indexa la tabla hash de poses de la ultima pose que fue cargada. Si es &amp;lt;code&amp;gt;$FF&amp;lt;/code&amp;gt; entonces nunca se ha cargado una pose previamente.  Si es &amp;lt;code&amp;gt;$FF&amp;lt;/code&amp;gt; entonces nunca se ha cargado una pose previamente.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;!LastFlip,x&#039;&#039;&#039;: Es el valor de &amp;lt;code&amp;gt;!GlobalFlip,x XOR !LocalFlip,x&amp;lt;/code&amp;gt; que tenia la ultima pose que fue cargada. Al momento de dibujar o de hacer una rutina de interacción que tenga cajas de colisión dependientes de la pose, se debería utilizar esta tabla. Si es &amp;lt;code&amp;gt;$FF&amp;lt;/code&amp;gt; entonces nunca se ha cargado una pose previamente.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;$04&#039;&#039;&#039;: Tendra el valor &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; si el primer tile de la pose esta cargado en SP1 o SP2, o &amp;lt;code&amp;gt;$01&amp;lt;/code&amp;gt; si el primer tile de la pose fue cargado en SP3 o SP4.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;$08&#039;&#039;&#039;: Tiene el Offset del primer Tile que se cargo en la pose.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;UploadWithoutPoseOffset&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Versiones&#039;&#039;&#039;: %DXNormalUploadWithoutPoseOffset(), %DXClusterUploadWithoutPoseOffset(), %DXExtendedUploadWithoutPoseOffset().&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Input&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A&#039;&#039;&#039;: ID de la pose deseada (16 bits). Puedes utilizar los defines autogenerados por Dynamic X para la pose que inician con &amp;lt;code&amp;gt;!DynamicPoseID&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Outputs&#039;&#039;&#039;: Los mismos de &#039;&#039;&#039;Upload&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
==== Draw ====&lt;br /&gt;
La segunda rutina es &#039;&#039;&#039;Draw&#039;&#039;&#039;, esta rutina se encarga de dibujar una pose, puede recibir ciertos parámetros para cambiar las propiedades, la posición o la prioridad de la pose. Tiene 2 versiones distintas &#039;&#039;&#039;Draw&#039;&#039;&#039; y &#039;&#039;&#039;DrawWithOffset&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Draw&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Versiones&#039;&#039;&#039;: %DXNormalDraw(), %DXClusterDraw(), %DXExtendedDraw()&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Inputs&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;DrawWithOffset&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Versiones&#039;&#039;&#039;: %DXNormalDrawWithOffset(), %DXClusterDrawWithOffset(), %DXExtendedDrawWithOffset()&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Carga de Gráficos ===&lt;br /&gt;
=== Carga de Paletas ===&lt;br /&gt;
=== Paletas de Sprites ===&lt;br /&gt;
==== Asignación de Paletas ====&lt;br /&gt;
===== Restringir Sobre escritura de Paletas =====&lt;br /&gt;
&lt;br /&gt;
=== Efectos de paletas ===&lt;br /&gt;
=== Cambiar Gráficos del Player usando un GFX similar al GFX32 ===&lt;br /&gt;
=== Cambiar Gráficos del Player ===&lt;br /&gt;
=== Cambiar Paleta del Player ===&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15113</id>
		<title>Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15113"/>
		<updated>2024-01-20T00:09:25Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Draw Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X is an advanced dynamic load management system whose purpose is to support the transfer of graphics and color palettes to the VRAM and CGRAM respectively. This system would replace Dynamic Z V3.7 which in turn is a replacement for DSX.&lt;br /&gt;
== Download ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
= Features =&lt;br /&gt;
*Load Poses Dynamically: Allows to load poses for Dynamic Sprites from any ASM code.&lt;br /&gt;
*Draw Poses: Allows to draw any pose that is registered in the system anywhere on the screen and from any ASM code. The way of drawing is totally optimized for each pose, basically all the poses that have similar characteristics, use the same graphic routine to optimize cycles and to make it as efficient as possible, besides diminishing considerably the amount of ROM used in graphic routines, since, 1 graphic routine can draw hundreds of different poses that belong to different Sprites.&lt;br /&gt;
*Load Graphics to VRAM.&lt;br /&gt;
*Load Color Palettes to the CGRAM.&lt;br /&gt;
*Automatic Palette Assignment: When a Sprite loads a palette, it can ask the system to assign a palette in an automated way, it will look for a free palette and it can be used by the Sprite, in case the palette is already loaded in the loaded CGRAM then it will give the Sprite that palette. The system informs if there are no palettes available, this way, you can avoid that the Sprite tries to work with wrong palettes.&lt;br /&gt;
*Color Palette Effects: You can edit the palettes that are loaded to change attributes such as Hue, Saturation and Brightness, you can weight them with a preset color or de-power certain RGB or HSL channels.&lt;br /&gt;
*Registration of Graphics and Palettes: The system allows you to insert graphics and palettes in the ROM, when you do so, the position in which they were saved in the ROM are available and you can also know the ID with which it was registered in the system, you can use that ID to dynamically load those graphics. Dynamic X will take care of deleting the graphics and palettes previously saved by the system and insert the new graphics and palettes in a free place in the ROM.&lt;br /&gt;
== Features that may have compatibility issues ==&lt;br /&gt;
*Custom Player Graphics: Dynamic X allows you to either change the player graphics using an EXGFX similar to GFX32 being limited to use the size and number of poses of the Vanilla game or simply disable completely the dynamic loading of player graphics, yoshi or podoboos to make your own dynamic routine for a custom player without limitations of size or number of poses. This feature allows you to change the graphics at any time, so you could use different players in different levels or in different areas of the same level.&lt;br /&gt;
*Player Custom Palettes: Dynamic X allows you to change the player&#039;s color palette freely.&lt;br /&gt;
*Player DMA optimizations: Dynamic X decreases considerably the cycles used by the NMI handler, since, the player graphics, yoshi and podoboos are only loaded in the VRAM when they are required, not always as it happens in the Vanilla game. This also leaves you some extra tiles in SP1 in levels that don&#039;t use yoshi or podoboos, even an extra tile in levels that don&#039;t use the layer.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
= Installation =&lt;br /&gt;
== General Steps ==&lt;br /&gt;
Before installing Dynamic X.&lt;br /&gt;
# The ROM must have SA-1 Pack installed.&lt;br /&gt;
# Put all files with &amp;quot;.drawinfo&amp;quot; extension in the &amp;quot;DrawInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.dynamicinfo&amp;quot; extension in the &amp;quot;DynamicInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.paleffect&amp;quot; extension in the &amp;quot;PaletteEffects&amp;quot; folder.&lt;br /&gt;
# Put all resource files such as GFXs and Color Palettes with &amp;quot;.bin&amp;quot; extension in the &amp;quot;DynamicResources&amp;quot; folder.&lt;br /&gt;
== Using the Tool Directly ==&lt;br /&gt;
You can install Dynamic X by opening the file &amp;quot;DynamicXTool.exe&amp;quot;, it will open a console telling you what to type at any given moment. It will start asking you for the ROM paths, Pixi folder, UberasmTool or GPS (these last 3 are optional) and then it will ask you for the features you want to install, put &amp;quot;y&amp;quot; or &amp;quot;yes&amp;quot; to enable each feature and &amp;quot;n&amp;quot; or &amp;quot;no&amp;quot; to disable that feature.&lt;br /&gt;
Warning: Features such as Player Features and Status Bar Optimization, may have incompatibilities with other resources, so you should be careful when installing them. Be careful which features you install.&lt;br /&gt;
&lt;br /&gt;
== Using the Tool From Console ==&lt;br /&gt;
You must call the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ROM will install with the default settings if you have never done a previous installation, if you have done a previous installation, then the settings used in that installation will be used.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
In case you want to change the settings manually you must open the settings.json file that will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must change the parameters according to the settings you want.&lt;br /&gt;
= Formats =&lt;br /&gt;
== Dynamic Info ==&lt;br /&gt;
Files with extension &amp;quot;.dynamicinfo&amp;quot; are used to insert pose graphics, palettes and other resources into the ROM. They also include the information necessary for the poses to be loaded correctly into the VRAM.&lt;br /&gt;
&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Below this label goes each graphics file used to load dynamic poses. Example: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Below this label goes each color palette file used for dynamic poses. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesSizes&#039;&#039;&#039;&#039;: Below this file goes 2 lines for each pose, the first line is a label describing the pose and the second line is 2 values, each of these values indicates how many 8x8 tiles are used in each chunk, each dynamic pose has 2 chunks of data generally (except some exceptions that may require only 1 chunk), the top chunk and the bottom chunk. The top chunk is all the 8x8 tiles that are before the last 8 pixels high line, while the bottom chunk is the last line. In the following example you can see 3 images, the left one is how the assembled image should look like, the second one is how it would look like in the VRAM and the third one is how it would be saved in the binary file, it would also show how the poses sizes of that pose are, which in this case would be 8 tiles of the top chunk and 8 tiles of the bottom chunk:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: For poses whose number of 8x8 tiles is divisible by 32, you can use only the top chunk that has all the tiles and the bottom chunk would be 0.&lt;br /&gt;
&lt;br /&gt;
== Draw Info ==&lt;br /&gt;
The files with extension &amp;quot;.drawinfo&amp;quot;, have the necessary information to draw poses, these poses can be dynamic or static poses. Dynamic X uses these files to generate optimized graphic routines for each pose, the tool detects if one of the tables is necessary or not, eliminates redundant data, pigeonholes each pose in a group that shares similar characteristics and then inserts a graphic routine for each group of poses that share similar characteristics.&lt;br /&gt;
The file format is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: If true it is dynamic, if false it is static, example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: It is a table that indicates which tiles each pose uses, in the case of the dynamic poses it must be considered that the tile of more superior to the left is the tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, this table contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; and the second line would be each one of the tiles used by the pose This table is optional and in case it is not, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the tiles of the pose.This table is optional and in case it is not present, it will use the value $00 for the tiles of the pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: It is a table that indicates the horizontal displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code&amp;gt; and the second line is a value for each tile of the pose indicating how much should move horizontally each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped horizontally, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code&amp;gt;. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flippingThe following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15112</id>
		<title>Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15112"/>
		<updated>2024-01-20T00:08:54Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Draw Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X is an advanced dynamic load management system whose purpose is to support the transfer of graphics and color palettes to the VRAM and CGRAM respectively. This system would replace Dynamic Z V3.7 which in turn is a replacement for DSX.&lt;br /&gt;
== Download ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
= Features =&lt;br /&gt;
*Load Poses Dynamically: Allows to load poses for Dynamic Sprites from any ASM code.&lt;br /&gt;
*Draw Poses: Allows to draw any pose that is registered in the system anywhere on the screen and from any ASM code. The way of drawing is totally optimized for each pose, basically all the poses that have similar characteristics, use the same graphic routine to optimize cycles and to make it as efficient as possible, besides diminishing considerably the amount of ROM used in graphic routines, since, 1 graphic routine can draw hundreds of different poses that belong to different Sprites.&lt;br /&gt;
*Load Graphics to VRAM.&lt;br /&gt;
*Load Color Palettes to the CGRAM.&lt;br /&gt;
*Automatic Palette Assignment: When a Sprite loads a palette, it can ask the system to assign a palette in an automated way, it will look for a free palette and it can be used by the Sprite, in case the palette is already loaded in the loaded CGRAM then it will give the Sprite that palette. The system informs if there are no palettes available, this way, you can avoid that the Sprite tries to work with wrong palettes.&lt;br /&gt;
*Color Palette Effects: You can edit the palettes that are loaded to change attributes such as Hue, Saturation and Brightness, you can weight them with a preset color or de-power certain RGB or HSL channels.&lt;br /&gt;
*Registration of Graphics and Palettes: The system allows you to insert graphics and palettes in the ROM, when you do so, the position in which they were saved in the ROM are available and you can also know the ID with which it was registered in the system, you can use that ID to dynamically load those graphics. Dynamic X will take care of deleting the graphics and palettes previously saved by the system and insert the new graphics and palettes in a free place in the ROM.&lt;br /&gt;
== Features that may have compatibility issues ==&lt;br /&gt;
*Custom Player Graphics: Dynamic X allows you to either change the player graphics using an EXGFX similar to GFX32 being limited to use the size and number of poses of the Vanilla game or simply disable completely the dynamic loading of player graphics, yoshi or podoboos to make your own dynamic routine for a custom player without limitations of size or number of poses. This feature allows you to change the graphics at any time, so you could use different players in different levels or in different areas of the same level.&lt;br /&gt;
*Player Custom Palettes: Dynamic X allows you to change the player&#039;s color palette freely.&lt;br /&gt;
*Player DMA optimizations: Dynamic X decreases considerably the cycles used by the NMI handler, since, the player graphics, yoshi and podoboos are only loaded in the VRAM when they are required, not always as it happens in the Vanilla game. This also leaves you some extra tiles in SP1 in levels that don&#039;t use yoshi or podoboos, even an extra tile in levels that don&#039;t use the layer.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
= Installation =&lt;br /&gt;
== General Steps ==&lt;br /&gt;
Before installing Dynamic X.&lt;br /&gt;
# The ROM must have SA-1 Pack installed.&lt;br /&gt;
# Put all files with &amp;quot;.drawinfo&amp;quot; extension in the &amp;quot;DrawInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.dynamicinfo&amp;quot; extension in the &amp;quot;DynamicInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.paleffect&amp;quot; extension in the &amp;quot;PaletteEffects&amp;quot; folder.&lt;br /&gt;
# Put all resource files such as GFXs and Color Palettes with &amp;quot;.bin&amp;quot; extension in the &amp;quot;DynamicResources&amp;quot; folder.&lt;br /&gt;
== Using the Tool Directly ==&lt;br /&gt;
You can install Dynamic X by opening the file &amp;quot;DynamicXTool.exe&amp;quot;, it will open a console telling you what to type at any given moment. It will start asking you for the ROM paths, Pixi folder, UberasmTool or GPS (these last 3 are optional) and then it will ask you for the features you want to install, put &amp;quot;y&amp;quot; or &amp;quot;yes&amp;quot; to enable each feature and &amp;quot;n&amp;quot; or &amp;quot;no&amp;quot; to disable that feature.&lt;br /&gt;
Warning: Features such as Player Features and Status Bar Optimization, may have incompatibilities with other resources, so you should be careful when installing them. Be careful which features you install.&lt;br /&gt;
&lt;br /&gt;
== Using the Tool From Console ==&lt;br /&gt;
You must call the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ROM will install with the default settings if you have never done a previous installation, if you have done a previous installation, then the settings used in that installation will be used.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
In case you want to change the settings manually you must open the settings.json file that will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must change the parameters according to the settings you want.&lt;br /&gt;
= Formats =&lt;br /&gt;
== Dynamic Info ==&lt;br /&gt;
Files with extension &amp;quot;.dynamicinfo&amp;quot; are used to insert pose graphics, palettes and other resources into the ROM. They also include the information necessary for the poses to be loaded correctly into the VRAM.&lt;br /&gt;
&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Below this label goes each graphics file used to load dynamic poses. Example: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Below this label goes each color palette file used for dynamic poses. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesSizes&#039;&#039;&#039;&#039;: Below this file goes 2 lines for each pose, the first line is a label describing the pose and the second line is 2 values, each of these values indicates how many 8x8 tiles are used in each chunk, each dynamic pose has 2 chunks of data generally (except some exceptions that may require only 1 chunk), the top chunk and the bottom chunk. The top chunk is all the 8x8 tiles that are before the last 8 pixels high line, while the bottom chunk is the last line. In the following example you can see 3 images, the left one is how the assembled image should look like, the second one is how it would look like in the VRAM and the third one is how it would be saved in the binary file, it would also show how the poses sizes of that pose are, which in this case would be 8 tiles of the top chunk and 8 tiles of the bottom chunk:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: For poses whose number of 8x8 tiles is divisible by 32, you can use only the top chunk that has all the tiles and the bottom chunk would be 0.&lt;br /&gt;
&lt;br /&gt;
== Draw Info ==&lt;br /&gt;
The files with extension &amp;quot;.drawinfo&amp;quot;, have the necessary information to draw poses, these poses can be dynamic or static poses. Dynamic X uses these files to generate optimized graphic routines for each pose, the tool detects if one of the tables is necessary or not, eliminates redundant data, pigeonholes each pose in a group that shares similar characteristics and then inserts a graphic routine for each group of poses that share similar characteristics.&lt;br /&gt;
The file format is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;: If true it is dynamic, if false it is static, example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;: It is a table that indicates which tiles each pose uses, in the case of the dynamic poses it must be considered that the tile of more superior to the left is the tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, this table contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; and the second line would be each one of the tiles used by the pose This table is optional and in case it is not, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the tiles of the pose.This table is optional and in case it is not present, it will use the value $00 for the tiles of the pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;XDisplacements&#039;&#039;&#039;: It is a table that indicates the horizontal displacement of each tile with respect to the pose position and contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_XDisp:&amp;lt;/code and the second line is a value for each tile of the pose indicating how much should move horizontally each tile with respect to the pose position, additionally you can add 2 more lines for each pose for when the pose is flipped horizontally, the format is the same as the previous 2 lines only that the first line is &amp;lt;code&amp;gt;PoseName_XDispFlipX:&amp;lt;/code. This table is optional and if it does not exist, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code for the pose tiles.The following example draws 4 tiles forming a 32x32 pose and allowing horizontal flippingThe following example draws 4 tiles forming a 32x32 pose and allowing horizontal flipping:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XDisplacements:&lt;br /&gt;
Pose32x32_XDisp:&lt;br /&gt;
    db $00,$10,$00,$10&lt;br /&gt;
Pose32x32_XDispFlipX:&lt;br /&gt;
    db $10,$00,$10,$00&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15111</id>
		<title>Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15111"/>
		<updated>2024-01-20T00:03:13Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Draw Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X is an advanced dynamic load management system whose purpose is to support the transfer of graphics and color palettes to the VRAM and CGRAM respectively. This system would replace Dynamic Z V3.7 which in turn is a replacement for DSX.&lt;br /&gt;
== Download ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
= Features =&lt;br /&gt;
*Load Poses Dynamically: Allows to load poses for Dynamic Sprites from any ASM code.&lt;br /&gt;
*Draw Poses: Allows to draw any pose that is registered in the system anywhere on the screen and from any ASM code. The way of drawing is totally optimized for each pose, basically all the poses that have similar characteristics, use the same graphic routine to optimize cycles and to make it as efficient as possible, besides diminishing considerably the amount of ROM used in graphic routines, since, 1 graphic routine can draw hundreds of different poses that belong to different Sprites.&lt;br /&gt;
*Load Graphics to VRAM.&lt;br /&gt;
*Load Color Palettes to the CGRAM.&lt;br /&gt;
*Automatic Palette Assignment: When a Sprite loads a palette, it can ask the system to assign a palette in an automated way, it will look for a free palette and it can be used by the Sprite, in case the palette is already loaded in the loaded CGRAM then it will give the Sprite that palette. The system informs if there are no palettes available, this way, you can avoid that the Sprite tries to work with wrong palettes.&lt;br /&gt;
*Color Palette Effects: You can edit the palettes that are loaded to change attributes such as Hue, Saturation and Brightness, you can weight them with a preset color or de-power certain RGB or HSL channels.&lt;br /&gt;
*Registration of Graphics and Palettes: The system allows you to insert graphics and palettes in the ROM, when you do so, the position in which they were saved in the ROM are available and you can also know the ID with which it was registered in the system, you can use that ID to dynamically load those graphics. Dynamic X will take care of deleting the graphics and palettes previously saved by the system and insert the new graphics and palettes in a free place in the ROM.&lt;br /&gt;
== Features that may have compatibility issues ==&lt;br /&gt;
*Custom Player Graphics: Dynamic X allows you to either change the player graphics using an EXGFX similar to GFX32 being limited to use the size and number of poses of the Vanilla game or simply disable completely the dynamic loading of player graphics, yoshi or podoboos to make your own dynamic routine for a custom player without limitations of size or number of poses. This feature allows you to change the graphics at any time, so you could use different players in different levels or in different areas of the same level.&lt;br /&gt;
*Player Custom Palettes: Dynamic X allows you to change the player&#039;s color palette freely.&lt;br /&gt;
*Player DMA optimizations: Dynamic X decreases considerably the cycles used by the NMI handler, since, the player graphics, yoshi and podoboos are only loaded in the VRAM when they are required, not always as it happens in the Vanilla game. This also leaves you some extra tiles in SP1 in levels that don&#039;t use yoshi or podoboos, even an extra tile in levels that don&#039;t use the layer.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
= Installation =&lt;br /&gt;
== General Steps ==&lt;br /&gt;
Before installing Dynamic X.&lt;br /&gt;
# The ROM must have SA-1 Pack installed.&lt;br /&gt;
# Put all files with &amp;quot;.drawinfo&amp;quot; extension in the &amp;quot;DrawInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.dynamicinfo&amp;quot; extension in the &amp;quot;DynamicInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.paleffect&amp;quot; extension in the &amp;quot;PaletteEffects&amp;quot; folder.&lt;br /&gt;
# Put all resource files such as GFXs and Color Palettes with &amp;quot;.bin&amp;quot; extension in the &amp;quot;DynamicResources&amp;quot; folder.&lt;br /&gt;
== Using the Tool Directly ==&lt;br /&gt;
You can install Dynamic X by opening the file &amp;quot;DynamicXTool.exe&amp;quot;, it will open a console telling you what to type at any given moment. It will start asking you for the ROM paths, Pixi folder, UberasmTool or GPS (these last 3 are optional) and then it will ask you for the features you want to install, put &amp;quot;y&amp;quot; or &amp;quot;yes&amp;quot; to enable each feature and &amp;quot;n&amp;quot; or &amp;quot;no&amp;quot; to disable that feature.&lt;br /&gt;
Warning: Features such as Player Features and Status Bar Optimization, may have incompatibilities with other resources, so you should be careful when installing them. Be careful which features you install.&lt;br /&gt;
&lt;br /&gt;
== Using the Tool From Console ==&lt;br /&gt;
You must call the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ROM will install with the default settings if you have never done a previous installation, if you have done a previous installation, then the settings used in that installation will be used.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
In case you want to change the settings manually you must open the settings.json file that will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must change the parameters according to the settings you want.&lt;br /&gt;
= Formats =&lt;br /&gt;
== Dynamic Info ==&lt;br /&gt;
Files with extension &amp;quot;.dynamicinfo&amp;quot; are used to insert pose graphics, palettes and other resources into the ROM. They also include the information necessary for the poses to be loaded correctly into the VRAM.&lt;br /&gt;
&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Below this label goes each graphics file used to load dynamic poses. Example: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Below this label goes each color palette file used for dynamic poses. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesSizes&#039;&#039;&#039;&#039;: Below this file goes 2 lines for each pose, the first line is a label describing the pose and the second line is 2 values, each of these values indicates how many 8x8 tiles are used in each chunk, each dynamic pose has 2 chunks of data generally (except some exceptions that may require only 1 chunk), the top chunk and the bottom chunk. The top chunk is all the 8x8 tiles that are before the last 8 pixels high line, while the bottom chunk is the last line. In the following example you can see 3 images, the left one is how the assembled image should look like, the second one is how it would look like in the VRAM and the third one is how it would be saved in the binary file, it would also show how the poses sizes of that pose are, which in this case would be 8 tiles of the top chunk and 8 tiles of the bottom chunk:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: For poses whose number of 8x8 tiles is divisible by 32, you can use only the top chunk that has all the tiles and the bottom chunk would be 0.&lt;br /&gt;
&lt;br /&gt;
== Draw Info ==&lt;br /&gt;
The files with extension &amp;quot;.drawinfo&amp;quot;, have the necessary information to draw poses, these poses can be dynamic or static poses. Dynamic X uses these files to generate optimized graphic routines for each pose, the tool detects if one of the tables is necessary or not, eliminates redundant data, pigeonholes each pose in a group that shares similar characteristics and then inserts a graphic routine for each group of poses that share similar characteristics.&lt;br /&gt;
The file format is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;&#039;: If true it is dynamic, if false it is static, example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;&#039;: It is a table that indicates which tiles each pose uses, in the case of the dynamic poses it must be considered that the tile of more superior to the left is the tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, this table contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; and the second line would be each one of the tiles used by the pose This table is optional and in case it is not, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the tiles of the pose.This table is optional and in case it is not present, it will use the value $00 for the tiles of the pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15110</id>
		<title>Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15110"/>
		<updated>2024-01-20T00:03:00Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Dynamic Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X is an advanced dynamic load management system whose purpose is to support the transfer of graphics and color palettes to the VRAM and CGRAM respectively. This system would replace Dynamic Z V3.7 which in turn is a replacement for DSX.&lt;br /&gt;
== Download ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
= Features =&lt;br /&gt;
*Load Poses Dynamically: Allows to load poses for Dynamic Sprites from any ASM code.&lt;br /&gt;
*Draw Poses: Allows to draw any pose that is registered in the system anywhere on the screen and from any ASM code. The way of drawing is totally optimized for each pose, basically all the poses that have similar characteristics, use the same graphic routine to optimize cycles and to make it as efficient as possible, besides diminishing considerably the amount of ROM used in graphic routines, since, 1 graphic routine can draw hundreds of different poses that belong to different Sprites.&lt;br /&gt;
*Load Graphics to VRAM.&lt;br /&gt;
*Load Color Palettes to the CGRAM.&lt;br /&gt;
*Automatic Palette Assignment: When a Sprite loads a palette, it can ask the system to assign a palette in an automated way, it will look for a free palette and it can be used by the Sprite, in case the palette is already loaded in the loaded CGRAM then it will give the Sprite that palette. The system informs if there are no palettes available, this way, you can avoid that the Sprite tries to work with wrong palettes.&lt;br /&gt;
*Color Palette Effects: You can edit the palettes that are loaded to change attributes such as Hue, Saturation and Brightness, you can weight them with a preset color or de-power certain RGB or HSL channels.&lt;br /&gt;
*Registration of Graphics and Palettes: The system allows you to insert graphics and palettes in the ROM, when you do so, the position in which they were saved in the ROM are available and you can also know the ID with which it was registered in the system, you can use that ID to dynamically load those graphics. Dynamic X will take care of deleting the graphics and palettes previously saved by the system and insert the new graphics and palettes in a free place in the ROM.&lt;br /&gt;
== Features that may have compatibility issues ==&lt;br /&gt;
*Custom Player Graphics: Dynamic X allows you to either change the player graphics using an EXGFX similar to GFX32 being limited to use the size and number of poses of the Vanilla game or simply disable completely the dynamic loading of player graphics, yoshi or podoboos to make your own dynamic routine for a custom player without limitations of size or number of poses. This feature allows you to change the graphics at any time, so you could use different players in different levels or in different areas of the same level.&lt;br /&gt;
*Player Custom Palettes: Dynamic X allows you to change the player&#039;s color palette freely.&lt;br /&gt;
*Player DMA optimizations: Dynamic X decreases considerably the cycles used by the NMI handler, since, the player graphics, yoshi and podoboos are only loaded in the VRAM when they are required, not always as it happens in the Vanilla game. This also leaves you some extra tiles in SP1 in levels that don&#039;t use yoshi or podoboos, even an extra tile in levels that don&#039;t use the layer.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
= Installation =&lt;br /&gt;
== General Steps ==&lt;br /&gt;
Before installing Dynamic X.&lt;br /&gt;
# The ROM must have SA-1 Pack installed.&lt;br /&gt;
# Put all files with &amp;quot;.drawinfo&amp;quot; extension in the &amp;quot;DrawInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.dynamicinfo&amp;quot; extension in the &amp;quot;DynamicInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.paleffect&amp;quot; extension in the &amp;quot;PaletteEffects&amp;quot; folder.&lt;br /&gt;
# Put all resource files such as GFXs and Color Palettes with &amp;quot;.bin&amp;quot; extension in the &amp;quot;DynamicResources&amp;quot; folder.&lt;br /&gt;
== Using the Tool Directly ==&lt;br /&gt;
You can install Dynamic X by opening the file &amp;quot;DynamicXTool.exe&amp;quot;, it will open a console telling you what to type at any given moment. It will start asking you for the ROM paths, Pixi folder, UberasmTool or GPS (these last 3 are optional) and then it will ask you for the features you want to install, put &amp;quot;y&amp;quot; or &amp;quot;yes&amp;quot; to enable each feature and &amp;quot;n&amp;quot; or &amp;quot;no&amp;quot; to disable that feature.&lt;br /&gt;
Warning: Features such as Player Features and Status Bar Optimization, may have incompatibilities with other resources, so you should be careful when installing them. Be careful which features you install.&lt;br /&gt;
&lt;br /&gt;
== Using the Tool From Console ==&lt;br /&gt;
You must call the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ROM will install with the default settings if you have never done a previous installation, if you have done a previous installation, then the settings used in that installation will be used.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
In case you want to change the settings manually you must open the settings.json file that will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must change the parameters according to the settings you want.&lt;br /&gt;
= Formats =&lt;br /&gt;
== Dynamic Info ==&lt;br /&gt;
Files with extension &amp;quot;.dynamicinfo&amp;quot; are used to insert pose graphics, palettes and other resources into the ROM. They also include the information necessary for the poses to be loaded correctly into the VRAM.&lt;br /&gt;
&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Below this label goes each graphics file used to load dynamic poses. Example: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Below this label goes each color palette file used for dynamic poses. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesSizes&#039;&#039;&#039;&#039;: Below this file goes 2 lines for each pose, the first line is a label describing the pose and the second line is 2 values, each of these values indicates how many 8x8 tiles are used in each chunk, each dynamic pose has 2 chunks of data generally (except some exceptions that may require only 1 chunk), the top chunk and the bottom chunk. The top chunk is all the 8x8 tiles that are before the last 8 pixels high line, while the bottom chunk is the last line. In the following example you can see 3 images, the left one is how the assembled image should look like, the second one is how it would look like in the VRAM and the third one is how it would be saved in the binary file, it would also show how the poses sizes of that pose are, which in this case would be 8 tiles of the top chunk and 8 tiles of the bottom chunk:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: For poses whose number of 8x8 tiles is divisible by 32, you can use only the top chunk that has all the tiles and the bottom chunk would be 0.&lt;br /&gt;
&lt;br /&gt;
=== Draw Info ===&lt;br /&gt;
The files with extension &amp;quot;.drawinfo&amp;quot;, have the necessary information to draw poses, these poses can be dynamic or static poses. Dynamic X uses these files to generate optimized graphic routines for each pose, the tool detects if one of the tables is necessary or not, eliminates redundant data, pigeonholes each pose in a group that shares similar characteristics and then inserts a graphic routine for each group of poses that share similar characteristics.&lt;br /&gt;
The file format is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	...&lt;br /&gt;
Tiles:&lt;br /&gt;
	...&lt;br /&gt;
XDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
YDisplacements:&lt;br /&gt;
	...&lt;br /&gt;
Sizes:&lt;br /&gt;
	...&lt;br /&gt;
Properties:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Dynamic&#039;&#039;&#039;&#039;: If true it is dynamic, if false it is static, example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Dynamic: &lt;br /&gt;
	true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Tiles&#039;&#039;&#039;&#039;: It is a table that indicates which tiles each pose uses, in the case of the dynamic poses it must be considered that the tile of more superior to the left is the tile &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt;, this table contains 2 lines for each pose, the first line is &amp;lt;code&amp;gt;PoseName_Tiles:&amp;lt;/code&amp;gt; and the second line would be each one of the tiles used by the pose This table is optional and in case it is not, it will use the value &amp;lt;code&amp;gt;$00&amp;lt;/code&amp;gt; for the tiles of the pose.This table is optional and in case it is not present, it will use the value $00 for the tiles of the pose:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tiles:&lt;br /&gt;
Pose32x32_Tiles:&lt;br /&gt;
    db $00,$02,$04,$06&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15109</id>
		<title>Dynamic X</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Dynamic_X&amp;diff=15109"/>
		<updated>2024-01-19T23:55:34Z</updated>

		<summary type="html">&lt;p&gt;Anonimzwx: /* Dynamic Info */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Select Language|Dynamic_X}}&lt;br /&gt;
Dynamic X is an advanced dynamic load management system whose purpose is to support the transfer of graphics and color palettes to the VRAM and CGRAM respectively. This system would replace Dynamic Z V3.7 which in turn is a replacement for DSX.&lt;br /&gt;
== Download ==&lt;br /&gt;
* [https://snestorage.com/index.php Dynamic X Website]&lt;br /&gt;
= Features =&lt;br /&gt;
*Load Poses Dynamically: Allows to load poses for Dynamic Sprites from any ASM code.&lt;br /&gt;
*Draw Poses: Allows to draw any pose that is registered in the system anywhere on the screen and from any ASM code. The way of drawing is totally optimized for each pose, basically all the poses that have similar characteristics, use the same graphic routine to optimize cycles and to make it as efficient as possible, besides diminishing considerably the amount of ROM used in graphic routines, since, 1 graphic routine can draw hundreds of different poses that belong to different Sprites.&lt;br /&gt;
*Load Graphics to VRAM.&lt;br /&gt;
*Load Color Palettes to the CGRAM.&lt;br /&gt;
*Automatic Palette Assignment: When a Sprite loads a palette, it can ask the system to assign a palette in an automated way, it will look for a free palette and it can be used by the Sprite, in case the palette is already loaded in the loaded CGRAM then it will give the Sprite that palette. The system informs if there are no palettes available, this way, you can avoid that the Sprite tries to work with wrong palettes.&lt;br /&gt;
*Color Palette Effects: You can edit the palettes that are loaded to change attributes such as Hue, Saturation and Brightness, you can weight them with a preset color or de-power certain RGB or HSL channels.&lt;br /&gt;
*Registration of Graphics and Palettes: The system allows you to insert graphics and palettes in the ROM, when you do so, the position in which they were saved in the ROM are available and you can also know the ID with which it was registered in the system, you can use that ID to dynamically load those graphics. Dynamic X will take care of deleting the graphics and palettes previously saved by the system and insert the new graphics and palettes in a free place in the ROM.&lt;br /&gt;
== Features that may have compatibility issues ==&lt;br /&gt;
*Custom Player Graphics: Dynamic X allows you to either change the player graphics using an EXGFX similar to GFX32 being limited to use the size and number of poses of the Vanilla game or simply disable completely the dynamic loading of player graphics, yoshi or podoboos to make your own dynamic routine for a custom player without limitations of size or number of poses. This feature allows you to change the graphics at any time, so you could use different players in different levels or in different areas of the same level.&lt;br /&gt;
*Player Custom Palettes: Dynamic X allows you to change the player&#039;s color palette freely.&lt;br /&gt;
*Player DMA optimizations: Dynamic X decreases considerably the cycles used by the NMI handler, since, the player graphics, yoshi and podoboos are only loaded in the VRAM when they are required, not always as it happens in the Vanilla game. This also leaves you some extra tiles in SP1 in levels that don&#039;t use yoshi or podoboos, even an extra tile in levels that don&#039;t use the layer.&lt;br /&gt;
&lt;br /&gt;
= Prerequisites =&lt;br /&gt;
* [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-7.0.306-windows-x86-installer .Net 7 x86]&lt;br /&gt;
= Installation =&lt;br /&gt;
== General Steps ==&lt;br /&gt;
Before installing Dynamic X.&lt;br /&gt;
# The ROM must have SA-1 Pack installed.&lt;br /&gt;
# Put all files with &amp;quot;.drawinfo&amp;quot; extension in the &amp;quot;DrawInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.dynamicinfo&amp;quot; extension in the &amp;quot;DynamicInfo&amp;quot; folder.&lt;br /&gt;
# Put all files with &amp;quot;.paleffect&amp;quot; extension in the &amp;quot;PaletteEffects&amp;quot; folder.&lt;br /&gt;
# Put all resource files such as GFXs and Color Palettes with &amp;quot;.bin&amp;quot; extension in the &amp;quot;DynamicResources&amp;quot; folder.&lt;br /&gt;
== Using the Tool Directly ==&lt;br /&gt;
You can install Dynamic X by opening the file &amp;quot;DynamicXTool.exe&amp;quot;, it will open a console telling you what to type at any given moment. It will start asking you for the ROM paths, Pixi folder, UberasmTool or GPS (these last 3 are optional) and then it will ask you for the features you want to install, put &amp;quot;y&amp;quot; or &amp;quot;yes&amp;quot; to enable each feature and &amp;quot;n&amp;quot; or &amp;quot;no&amp;quot; to disable that feature.&lt;br /&gt;
Warning: Features such as Player Features and Status Bar Optimization, may have incompatibilities with other resources, so you should be careful when installing them. Be careful which features you install.&lt;br /&gt;
&lt;br /&gt;
== Using the Tool From Console ==&lt;br /&gt;
You must call the command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DynamicXTool -use-settings&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ROM will install with the default settings if you have never done a previous installation, if you have done a previous installation, then the settings used in that installation will be used.&lt;br /&gt;
&lt;br /&gt;
=== Settings ===&lt;br /&gt;
In case you want to change the settings manually you must open the settings.json file that will look like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;InputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;OutputROMPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;PixiPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;UberasmToolPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GPSPath&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
  &amp;quot;GraphicChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteChange&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PaletteEffects&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DynamicPoses&amp;quot;: true,&lt;br /&gt;
  &amp;quot;DrawingSystem&amp;quot;: true,&lt;br /&gt;
  &amp;quot;ControllerOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;FixedColorOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;StatusBarOptimization&amp;quot;: false,&lt;br /&gt;
  &amp;quot;ScrollingOptimization&amp;quot;: true,&lt;br /&gt;
  &amp;quot;PlayerFeatures&amp;quot;: false&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You must change the parameters according to the settings you want.&lt;br /&gt;
= Formats =&lt;br /&gt;
== Dynamic Info ==&lt;br /&gt;
Files with extension &amp;quot;.dynamicinfo&amp;quot; are used to insert pose graphics, palettes and other resources into the ROM. They also include the information necessary for the poses to be loaded correctly into the VRAM.&lt;br /&gt;
&lt;br /&gt;
The format of these files is as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics:&lt;br /&gt;
	...&lt;br /&gt;
Palettes:&lt;br /&gt;
	...&lt;br /&gt;
Resources:&lt;br /&gt;
	...&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
	...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesGraphics&#039;&#039;&#039;: Below this label goes each graphics file used to load dynamic poses. Example: &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesGraphics: &lt;br /&gt;
	DKCKlaptrap.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;Palettes&#039;&#039;&#039;: Below this label goes each color palette file used for dynamic poses. Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Palettes:&lt;br /&gt;
	DKCKlaptrapPal1.bin&lt;br /&gt;
	DKCKlaptrapPal2.bin&lt;br /&gt;
	DKCKlaptrapPal3.bin&lt;br /&gt;
	DKCKlaptrapPal4.bin&lt;br /&gt;
	DKCKlaptrapPal5.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;PosesSizes&#039;&#039;&#039;&#039;: Below this file goes 2 lines for each pose, the first line is a label describing the pose and the second line is 2 values, each of these values indicates how many 8x8 tiles are used in each chunk, each dynamic pose has 2 chunks of data generally (except some exceptions that may require only 1 chunk), the top chunk and the bottom chunk. The top chunk is all the 8x8 tiles that are before the last 8 pixels high line, while the bottom chunk is the last line. In the following example you can see 3 images, the left one is how the assembled image should look like, the second one is how it would look like in the VRAM and the third one is how it would be saved in the binary file, it would also show how the poses sizes of that pose are, which in this case would be 8 tiles of the top chunk and 8 tiles of the bottom chunk:&lt;br /&gt;
[[File:diagram1.png|center]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PosesChunksSizes:&lt;br /&gt;
Frame0_PoseChunksSizes:&lt;br /&gt;
    db $08,$08&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: For poses whose number of 8x8 tiles is divisible by 32, you can use only the top chunk that has all the tiles and the bottom chunk would be 0.&lt;/div&gt;</summary>
		<author><name>Anonimzwx</name></author>
	</entry>
</feed>