Bitte erst registrieren. Danach ist es möglich Beiträge zu schreiben.



 Nach unten   Vorheriges Thema   Nächstes Thema

#1
SAVERAM on Flashboy Plus
Geschrieben am: 27.02.2012 22:49
PVB Elite
Dabei seit 01.07.2011
Deutschland
796 Beiträge
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?
Nach oben

#2
Re: SAVERAM on Flashboy Plus
Geschrieben am: 27.02.2012 23:20
PVB Elite
Dabei seit 01.07.2011
Deutschland
796 Beiträge
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?
Nach oben

#3
Re: SAVERAM on Flashboy Plus
Geschrieben am: 27.02.2012 23:26
Nintendoid!
Dabei seit 08.08.2007
Großbritannien
198 Beiträge
CoderContributorHOTY09 EntryLong Time User (7 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.
Nach oben

#4
Re: SAVERAM on Flashboy Plus
Geschrieben am: 04.03.2012 9:55
PVB Elite
Dabei seit 25.07.2003
USA
1448 Beiträge
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
Nach oben

#5
Re: SAVERAM on Flashboy Plus
Geschrieben am: 04.03.2012 19:19
PVB Elite
Dabei seit 01.07.2011
Deutschland
796 Beiträge
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?
Nach oben

#6
Re: SAVERAM on Flashboy Plus
Geschrieben am: 05.03.2012 16:38
Administrator
Dabei seit 08.01.2000
Deutschland
2241 Beiträge
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! :-)
Nach oben

#7
Re: SAVERAM on Flashboy Plus
Geschrieben am: 22.03.2012 21:39
PVB Elite
Dabei seit 01.07.2011
Deutschland
796 Beiträge
CoderContributorLong Time User (3 Years)Top10 PosterApp CoderPVBCC 2013 Entry
I guess no one got this working so far.
Nach oben

#8
Re: SAVERAM on Flashboy Plus
Geschrieben am: 01.04.2012 21:21
PVB Elite
Dabei seit 01.07.2011
Deutschland
796 Beiträge
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
Nach oben

#9
Re: SAVERAM on Flashboy Plus
Geschrieben am: 28.05.2012 19:05
Administrator
Dabei seit 08.01.2000
Deutschland
2241 Beiträge
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?
Nach oben

#10
Re: SAVERAM on Flashboy Plus
Geschrieben am: 28.05.2012 22:24
PVB Elite
Dabei seit 28.12.2008
Slowenien
564 Beiträge
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];
}
Nach oben

 Nach oben   Vorheriges Thema   Nächstes Thema


Bitte erst registrieren. Danach ist es möglich Beiträge zu schreiben.

Nicht eingeloggt.
Passwort vergessen?
Registrieren Aktivierung neu senden