It is currently Thu Dec 13, 2018 3:24 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Mon Aug 21, 2006 5:01 am 
Offline
User avatar

Joined: Mon Aug 21, 2006 4:19 am
Posts: 77
Using java is better use this.

private static int[256][256] mem;

public void write(int adrs,byte dat)
{
mem[adrs>>8][adrs%256] = dat;
}

public byte read(int adrs)
{
return mem[adrs>>8][adrs%256];
}



Or this.
private static int[65536] mem;

public void write(int adrs,byte dat)
{
mem[adrs] = dat;
}

public byte read(int adrs)
{
return mem[adrs] ;
}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 5:40 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1440
First of all, in both places "mem" should be declared as byte, not int.

The first example only makes sense if each of the 256 slots in "mem" can be dynamically reassigned to new 256-byte arrays (equivalent to doing "unsigned char *mem[256];" in C). Even so, 256 bytes is rather small for a page size - 4096 bytes makes a bit more sense for CPU bank switching. Otherwise, the latter will be faster.

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 5:52 am 
Offline
User avatar

Joined: Mon Aug 21, 2006 4:19 am
Posts: 77
Quietust wrote:
First of all, in both places "mem" should be declared as byte, not int.

The first example only makes sense if each of the 256 slots in "mem" can be dynamically reassigned to new 256-byte arrays (equivalent to doing "unsigned char *mem[256];" in C). Even so, 256 bytes is rather small for a page size - 4096 bytes makes a bit more sense for CPU bank switching. Otherwise, the latter will be faster.


thanks so much.

What is the advantage in use a banks of 4096 and not 256? I was thinking that i will need to make it equal to original NES.

It can help on the memory mappers? (on the latter)

Thanks again.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 21, 2006 6:04 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20867
Location: NE Indiana, USA (NTSC)
dreampeppers99 wrote:
What is the advantage in use a banks of 4096 and not 256?

I'm guessing that the known NES mapper with the smallest banks works in 4096 byte banks. Also, when you have a mapper write that switches the banks, you only need to update one to eight internal banks, not 16 to 128.


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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