nesdev.com
http://forums.nesdev.com/

Simple CC65 NES ?
http://forums.nesdev.com/viewtopic.php?f=2&t=15569
Page 1 of 1

Author:  rfisher1968 [ Wed Feb 22, 2017 11:27 am ]
Post subject:  Simple CC65 NES ?

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);
}


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);
}


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.

Author:  rainwarrior [ Wed Feb 22, 2017 11:32 am ]
Post subject:  Re: Simple CC65 NES ?

$2041 and $2544 are on different nametables. How do you expect to see both of them at the same time? (You could check both nametables in a debugging emulator to verify.)

Your scroll position is set to 0,0 so I would expect you to only see A and not B, though.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/