It is currently Sat Dec 16, 2017 10:01 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Simple CC65 NES ?
PostPosted: Wed Feb 22, 2017 11:27 am 
Offline

Joined: Wed Feb 22, 2017 10:31 am
Posts: 1
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.


Top
 Profile  
 
 Post subject: Re: Simple CC65 NES ?
PostPosted: Wed Feb 22, 2017 11:32 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5899
Location: Canada
$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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: lazygecko, Yahoo [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group