Register To Post



 Bottom   Previous Topic   Next Topic

#1
SAVERAM on Flashboy Plus
Posted on: 2012/2/27 22:49
PVB Elite
Joined 2011/7/1
Germany
749 Posts
CoderContributorLong Time User (3 Years)Top10 PosterApp CoderPVBCC 2013 Entry
Hi everyone,

is there any trick when accessing the SAVERAM using the Flashboy Plus? I tried storing some values and everything works fine in RealityBoy. However, when I use the Flashboy I get strange results from data not being stored to randomly changing data.

Does anyone know how to fix this?
Top

#2
Re: SAVERAM on Flashboy Plus
Posted on: 2012/2/27 23:20
PVB Elite
Joined 2011/7/1
Germany
749 Posts
CoderContributorLong Time User (3 Years)Top10 PosterApp CoderPVBCC 2013 Entry
Ok... it seems to work now. Can anyone tell me how many bytes of SRAM are avalibiable?
Top

#3
Re: SAVERAM on Flashboy Plus
Posted on: 2012/2/27 23:26
Nintendoid!
Joined 2007/8/8
Great Britain
198 Posts
CoderContributorHOTY09 EntryLong Time User (6 Years) App Coder
Hi. This tripped me up too. It turns out only the even byte addresses in SRAM are accessible. The Flashboy has 8K of SRAM.
Top

#4
Re: SAVERAM on Flashboy Plus
Posted on: 2012/3/4 9:55
PVB Elite
Joined 2003/7/25
USA
1397 Posts
PVBCC 1stCoderContributor#2 PosterHOTY09 EntryLong Time User (11 Years) App CoderPVBCC 2010 EntryPVBCC 2013 Entry
Just like the SRAM on a regular cartridge, it's only an 8-bit wide chip on the 16-bit wide bus... so you have to access it through even addresses only.

DogP
Top

#5
Re: SAVERAM on Flashboy Plus
Posted on: 2012/3/4 19:19
PVB Elite
Joined 2011/7/1
Germany
749 Posts
CoderContributorLong Time User (3 Years)Top10 PosterApp CoderPVBCC 2013 Entry
I just noticed that SRAM access is till glitchy in GameHero. Obviously I am doing something wrong, even though I am only writing an accessing the even bytes.

Could you post some example code how to write 10 bytes to the SAVERAM and then access it again?
Top

#6
Re: SAVERAM on Flashboy Plus
Posted on: 2012/3/5 16:38
Administrator
Joined 2000/1/8
Germany
2215 Posts
Highscore Top10Highscore Top ScoreCoder#1 PosterHOTY09 1stLong Time User (14 Years) 90+ Game Ratings
Thanks for the clarifications, guys. I'd also love to see some working example code as I am also still having problems. Thanks! :-)
Top

#7
Re: SAVERAM on Flashboy Plus
Posted on: 2012/3/22 21:39
PVB Elite
Joined 2011/7/1
Germany
749 Posts
CoderContributorLong Time User (3 Years)Top10 PosterApp CoderPVBCC 2013 Entry
I guess no one got this working so far.
Top

#8
Re: SAVERAM on Flashboy Plus
Posted on: 2012/4/1 21:21
PVB Elite
Joined 2011/7/1
Germany
749 Posts
CoderContributorLong Time User (3 Years)Top10 PosterApp CoderPVBCC 2013 Entry
OK, this seems to work for me:


void saveToRam
(u8 valueu8 pos)
{
    
SAVERAM[(pos*2)+1] = value;
}

u8 getFromRam(u8 pos)
{
    
u8 value SAVERAM[(pos*2)+1];
    
    return (
u8)value;
}

void clearRam(u8 offsetu8 range)
{
    
u8 i 0;
    
    for(
i=offseti<rangei++)
    {
        
saveToRam(0i);
    }
}


Cheers,

thunder
Top

#9
Re: SAVERAM on Flashboy Plus
Posted on: 2012/5/28 19:05
Administrator
Joined 2000/1/8
Germany
2215 Posts
Highscore Top10Highscore Top ScoreCoder#1 PosterHOTY09 1stLong Time User (14 Years) 90+ Game Ratings
Thanks thunder, I was able to fix the save function of VUE Snake using your functions. :-) An u8 is not sufficient to address the whole SRAM, though. Here's the corrected functions:


void saveToRam
(u8 valueu16 pos)
{
    
SAVERAM[(pos*2)+1] = value;
}

u8 getFromRam(u16 pos)
{
    
u8 value SAVERAM[(pos*2)+1];
    
    return (
u8)value;
}

void clearRam(u16 offsetu16 range)
{
    
u16 i 0;
    
    for(
i=offseti<rangei++)
    {
        
saveToRam(0i);
    }
}


Does being able to write only even addresses mean that we can only use 4kb? Or is it actually a 16kb SRAM of which we can use 8kb?
Top

#10
Re: SAVERAM on Flashboy Plus
Posted on: 2012/5/28 22:24
PVB Elite
Joined 2008/12/28
Slovenia
534 Posts
Highscore Top ScoreHighscore Top ScoreCoderContributorLong Time User (5 Years)Top10 Poster10+ Game RatingsApp CoderPVBCC 2010 EntryPVBCC 2013 Entry
That wouldn't make sense. Maybe we just have to read/write 16 bits at a time and use masking to access odd-numbered bytes. Like this (untested):


void PokeSRAM 
(u16 Indexu8 Value)
{
  if(
Index 1)
  {
    
Index >>= 1;
    ((
u16*)SAVERAM)[Index] = (((u16*)SAVERAM)[Index] & 0xFF00) | Value;
  }
  else
    
SAVERAM[Index] = Value;
}

u8 PeekSRAM (u16 Index)
{
  if(
Index 1)
    return ((
u16*)SAVERAM)[Index >> 1] & 0x00FF;
  else
    return 
SAVERAM[Index];
}
Top

 Top   Previous Topic   Next Topic


Register To Post

You are not logged in.
Lost Password?
Register Resend Activation