We're using cookies to ensure you get the best experience on our website. More info
Understood
@horvatmRegistered December 28, 2008Active 4 months, 2 weeks ago
586 Replies made

VirtualChris wrote:
Can music using the Soviet engine be played while screens fade in and out?

The engine does its stuff whenever you call DoSounds. So you could use custom fading functions that call it while fading. Like this:

#define kBrightness 32  // You might want to make this a variable or a parameter to the fading functions.

void WaitForVIP ()
{
  // Waits for the VIP to finish drawing the current frame.

  while(!(VIP_REGS[INTPND] & XPEND));
  VIP_REGS[INTCLR] = XPEND;
}

void SetBrightness (u16 Brightness)
{
  // Sets the brightness.

  VIP_REGS[BRTA] = Brightness;
  VIP_REGS[BRTB] = Brightness << 1;
  VIP_REGS[BRTC] = Brightness;
}

void FadeIn ()
{
  u16 i;

  for(i = 0; i <= kBrightness; i += 2 /* change the 2 to adjust the speed */)
  {
    WaitForVIP();
    DoSounds();
    SetBrightness(i);
  }
}

void FadeOut ()
{
  u16 i;
  
  for(i = kBrightness; i > 1; i -= 2 /* same here */)
  {
    WaitForVIP();
    DoSounds();
    SetBrightness(i);
  }

  SetBrightness(0);  // Ensure it's pitch black.
}

Alternatively, you could use a VIP interrupt handler that would get called 50 times per second and have it call DoSounds. This would ensure that sounds get played no matter what, and at a consistent speed. I’ve never done that so I can’t help you there.

Red Alarm. It is the first VB game I played and whenever I play it, I still get the same feeling.

Golf too, the T&E guys were truly masters of VB programming.

And Bound High. Such a shame it didn’t get released.

You can set all the characters of a BGMap to use one palette and then modify the corresponding GPLT register. This will give you 4 levels of brightness.

http://www.planetvb.com/modules/dokuwiki/doku.php?id=palettes_and_transparency

Not at all. PCMCIA is much more narrow.

It seems to work now.

The problem appeared between midnight and 1 AM (GMT+1). I thought the server was more stable now in those hours. But the rest of the site worked OK, no errors or unresponsiveness.

EDIT:
And now again it doesn’t. It happens randomly.

  • This reply was modified 12 years, 6 months ago by HorvatM.

And you of course are a legendary coder who pumps out professional-quality games in weeks. And our standards were of medieval quality before you came along. And we are all idiots needing hand-holding having no idea how to accomplish things. And nobody else can think of cool ideas to implement.

Hideous? Blasphemy! Ever since I found out this was Georgia I’ve been using it as my default serif font everywhere. It sure beats Times New Roman, which is hideous.

HollowedEmpire wrote:
This question isn’t exactly related, but I figured I’d ask this too real quick. Is it good practice to use SRAM for just typical RAM use even if there is no need to save such data? I saw the profiling done by Guy Perfect and noticed there isn’t any speed penalty using it and potentially much bigger addressable space. I was planning to use WRAM for space to do decompressions at, and storing sprites/instruments at and using the SRAM as the main RAM. Would that be a good idea?

Sure, as long as you’re fine with your game not running on SRAM-less cartridges. I don’t think 8K of extra RAM is worth it. If you really need it, sacrifice one of the BGMaps, although VIP memory is slower to access. I think you should make it work first and then worry about performance if it’s not fast enough, because it probably will be.

Say for instance I create a u16 variable called gamePadState as a global variable. Does it keep this in WRAM or Cart RAM?

Global and static variables go into the WRAM. The cartridge SRAM is intended for saving game data. It is only accessed when you explicitly follow a pointer to it (the range 0x06xxxxxx).

What address does it decide to start at, the beginning of one of those two ranges or somewhere haphazardly?

I think it starts right at 0x05000000, but that’s an implementation detail and you shouldn’t even need to know about it, much less rely on it.

And what about if you specify specific addresses for other variables, as I am doing with tables of structs, does the compiler know enough to avoid the range when determining placement?

Please give an example. If you’re doing something like

struct MYSTRUCT* x = (struct MYSTRUCT*)0x0500ABCD;

then no, because you might be using that pointer to point to an array and access x[1000].

And is there a way you can specify ranges of memory these variables can be made in?

None that I know of. The vb.ld file maybe?

Also related, where do temporary variables, such as ones made during a chain assignment, get placed as well?

Temporary values go into the registers. In the case of running out of them (which is very unlikely on the V810), they would probably go on the stack, which is normally at the end of WRAM and grows towards lower addresses. The stack is also where local variables reside, unless you explicitly declare them with the register keyword (to my knowledge, gccVB will never automatically assign registers to them).

By extension, this is also very tied closely to the heap I imagine so any information regarding it as well would be appreciated!

If you’re writing a dynamic memory manager, probably the safest and simplest way to go is to just declare a large array (say, 32K) and manage that.

Ah, yes, I saw that one. I think it’s unfair to the VB to compare it to Google Glass.

Wow, that’s really cool. Black is the way to go though.

I wish him all the best and I hope he gets well soon. Please keep us updated.

Speaking of VBDE’s libgccvb, why doesn’t it have a bgmap.h? There were some useful macros there, BGM_PAL* if nothing else.

DogP wrote:
Yeah… when I built my first prototype VB<->PC cable years ago, a ROM dumper / memory reader/writer / remote code executer was the first application I wrote.

How did you do that? Wouldn’t you need specially programmed ROMs to do any communications?

I don’t remember if Alberto ever released his Virtual-E project with the USB link code added, but it’s pretty cool rendering things in OpenGL on the PC and viewing them in 3D on the VB.

Can data be transferred fast enough for full VB-quality video? If so, then who needs an Oculus Rift? 😛 Also, it would then be possible to display video from the VB on the PC and record it (with hacked ROMs, of course).

Guy Perfect wrote:
Copy a loading routine into RAM and execute it from there.

What if you use the instruction cache?

Not yet, but I will.

thunderstruck wrote:
When I worked on Fishbone I had quite some trouble organizing maps and chars I created. The basic problem is that after all of the tools always assume there will only be one charset (or 4). However, I often reused certain sprites forcing me to have them multiple times on different maps.

Do you think it would be possible, when converting a batch of images, to specify an offset for the chars? The charset itself would stay the same but the maps would reference to the respective chars + offset. That way someone could have multiple charsets and bgmaps.

I did just that in Advanced Pasta Cooking Simulator (I should release the source code for it some day – BTW, you should play with it a bit because there’s a cool “easter egg” in it). The program doesn’t have any option to do this, but you can easily do the same thing with efficient charsets. That’s how I did it (with efficient BGMaps as well, but you don’t have to):

// Pointer to VIP character memory
#define vbCharmem ((u16*)0x78000)

// Character indexes for LoadEfficientBGMap and LoadEfficientCharset
#define vbkCharseg0Index 0
#define vbkCharseg1Index 512
#define vbkCharseg2Index 1024
#define vbkCharseg3Index 1536

void LoadEfficientBGMap (
  const u16* Src, unsigned int BGMap, unsigned int CharIndexBase
)
{
  // Loads an efficiently stored VBIMGC-produced BGMap and optionally adjusts
  // the character indexes of its cells.

  unsigned int X;
  unsigned int Y;
  unsigned int Width;
  unsigned int Height;
  unsigned int Index;

  Width = Src[0] & 0x00FF;
  Height = Src[0] >> 8;

  Index = 1;
  for(Y = 0; Y < Height; Y++)
    for(X = 0; X < Width; X++)
      BGMM[BGMap * 0x1000 + Y * 64 + X] = Src[Index++] + CharIndexBase;
}

unsigned int LoadEfficientCharset (const u16* Src, unsigned int CharIndex)
{
  // Loads an efficiently stored VBIMGC-produced charset and returns the
  // index of the character immediately following it in the VIP's character
  // memory.

  unsigned int i;
  unsigned int Length;

  CharIndex *= 8;  // Convert to row index

  Length = Src[0] * 8;
  for(i = 1; i <= Length; i++)
    vbCharmem[CharIndex++] = Src[i];

  return CharIndex / 8;
}

void Init ()
{
  unsigned int CharIndex;

  // Font for vbTextOut
  LoadEfficientCharset(kChr_Font, vbkCharseg3Index + 32);

  // Sprites
  LoadEfficientBGMap(kBGM_SpritesLR, kBGMISprites, vbkCharseg1Index);
  CharIndex = LoadEfficientCharset(kChr_Sprites, vbkCharseg1Index);

  // Door
  LoadEfficientBGMap(kBGM_DoorLR, kBGMIDoor, CharIndex);
  CharIndex = LoadEfficientCharset(kChr_Door, CharIndex);

  // Stove view
  LoadEfficientBGMap(kBGM_StoveViewL, kBGMIStoveL, CharIndex);
  LoadEfficientBGMap(kBGM_StoveViewR, kBGMIStoveR, CharIndex);
  CharIndex = LoadEfficientCharset(kChr_StoveView, CharIndex);

  // Counter view
  LoadEfficientBGMap(kBGM_CounterViewL, kBGMICounterL, CharIndex);
  LoadEfficientBGMap(kBGM_CounterViewR, kBGMICounterR, CharIndex);
  CharIndex = LoadEfficientCharset(kChr_CounterView, CharIndex);

  // Fridge
  LoadEfficientBGMap(kBGM_FridgeLR, kBGMIFridge, CharIndex);
  CharIndex = LoadEfficientCharset(kChr_Fridge, CharIndex);

  // Outside view
  LoadEfficientBGMap(kBGM_OutsideViewLR, kBGMIOutside, CharIndex);
  CharIndex = LoadEfficientCharset(kChr_OutsideView, CharIndex);

  // Clouds
  LoadEfficientBGMap(kBGM_CloudsLR, kBGMIClouds, CharIndex);
  CharIndex = LoadEfficientCharset(kChr_Clouds, CharIndex);

  // (...)
}

It’s because the array in which BGMaps are generated is not initialized before generating each one. Should all cells be initialized to 0? That would only give you a blank BGMap if character 0 was blank though.

I never thought about that. The way I use it is to create a batch file in the same directory as the images and run it each time I want to regenerate the output.

Maybe there should be an option to use a file that contains a list of files to process and how to name the resulting arrays? This way, it would also be possible to specify different settings for each image and different output filenames.

MegaSilverX1 wrote:
Something along the lines of a Super Game Boy/Game Boy Player/PS Vita TV for the Virtual Boy would be awesome too.

You mean an emulator running on the VB?