Code:
#include <nes.h>
void main()
{
waitvblank();
*((unsigned char*)0x2006) = 0x3f;
*((unsigned char*)0x2006) = 0x00;
*((unsigned char*)0x2007) = 0x05; // put color 5 to address 0x3f00, which is the first in the above table
*((unsigned char*)0x2006) = 0x3f;
*((unsigned char*)0x2006) = 0x03;
*((unsigned char*)0x2007) = 0x02; // put color 2 to address 0x3f0x, which is the third in the above table.
*((unsigned char*)0x2006) = 0x20;
*((unsigned char*)0x2006) = 0x41;
*((unsigned char*)0x2007) = 'A'; // write letter.
*((unsigned char*)0x2005) = 0x00;
*((unsigned char*)0x2005) = 0x00;
/* Enable the screen */
/* By default, the screen and sprites were off */
*((unsigned char*)0x2001) = 8;
while(1);
}
void main()
{
waitvblank();
*((unsigned char*)0x2006) = 0x3f;
*((unsigned char*)0x2006) = 0x00;
*((unsigned char*)0x2007) = 0x05; // put color 5 to address 0x3f00, which is the first in the above table
*((unsigned char*)0x2006) = 0x3f;
*((unsigned char*)0x2006) = 0x03;
*((unsigned char*)0x2007) = 0x02; // put color 2 to address 0x3f0x, which is the third in the above table.
*((unsigned char*)0x2006) = 0x20;
*((unsigned char*)0x2006) = 0x41;
*((unsigned char*)0x2007) = 'A'; // write letter.
*((unsigned char*)0x2005) = 0x00;
*((unsigned char*)0x2005) = 0x00;
/* Enable the screen */
/* By default, the screen and sprites were off */
*((unsigned char*)0x2001) = 8;
while(1);
}
Prints the letter 'A' on the screen.
Code:
#include <nes.h>
void main()
{
waitvblank();
*((unsigned char*)0x2006) = 0x3f;
*((unsigned char*)0x2006) = 0x00;
*((unsigned char*)0x2007) = 0x05; // put color 5 to address 0x3f00, which is the first in the above table
*((unsigned char*)0x2006) = 0x3f;
*((unsigned char*)0x2006) = 0x03;
*((unsigned char*)0x2007) = 0x02; // put color 2 to address 0x3f0x, which is the third in the above table.
*((unsigned char*)0x2006) = 0x20;
*((unsigned char*)0x2006) = 0x41;
*((unsigned char*)0x2007) = 'A'; // write letter.
*((unsigned char*)0x2006) = 0x25;
*((unsigned char*)0x2006) = 0x44;
*((unsigned char*)0x2007) = 'B'; // write letter.
*((unsigned char*)0x2005) = 0x00;
*((unsigned char*)0x2005) = 0x00;
/* Enable the screen */
/* By default, the screen and sprites were off */
*((unsigned char*)0x2001) = 8;
while(1);
}
void main()
{
waitvblank();
*((unsigned char*)0x2006) = 0x3f;
*((unsigned char*)0x2006) = 0x00;
*((unsigned char*)0x2007) = 0x05; // put color 5 to address 0x3f00, which is the first in the above table
*((unsigned char*)0x2006) = 0x3f;
*((unsigned char*)0x2006) = 0x03;
*((unsigned char*)0x2007) = 0x02; // put color 2 to address 0x3f0x, which is the third in the above table.
*((unsigned char*)0x2006) = 0x20;
*((unsigned char*)0x2006) = 0x41;
*((unsigned char*)0x2007) = 'A'; // write letter.
*((unsigned char*)0x2006) = 0x25;
*((unsigned char*)0x2006) = 0x44;
*((unsigned char*)0x2007) = 'B'; // write letter.
*((unsigned char*)0x2005) = 0x00;
*((unsigned char*)0x2005) = 0x00;
/* Enable the screen */
/* By default, the screen and sprites were off */
*((unsigned char*)0x2001) = 8;
while(1);
}
This code only prints the letter 'B' instead of 'A' and 'B'.
Just looking for why does this happen and how can I display both.