Wow, that’s great! Actually the only thing DogP wasn’t clear on are the envelope registers and the waveform register. Now that I see how your PlayNote function works, it all seems really simple. Thank you once again!
Thanks!
I’m having some difficulty though. My libgccvb’s audio.h is a bit different:
typedef struct SOUNDREG
{
u8 ctl;
u8 spacer1[3];
u8 vol;
u8 spacer2[3];
u8 fql;
u8 spacer3[3];
u8 fqh;
u8 spacer4[3];
u8 env;
u8 spacer5[3];
u8 unk;
u8 spacer6[3];
u8 ram;
u8 spacer7[3];
u8 spacer8[36];
} SOUNDREG;
Which register is which? I’m assuming ‘EV0’ is ‘env’ and ‘INT’ is ‘ctl’. What I’m trying to do is this:
int main ()
{
unsigned int Freq;
SND_REGS[WAVE1].ram = 0;
SND_REGS[WAVE1].vol = 0x66;
SND_REGS[WAVE1].ctl = 0x80;
while(1)
{
for(Freq = 0; Freq <= 1000; Freq++)
{
SND_REGS[WAVE1].fql = (Freq << 4) & 0xFF;
SND_REGS[WAVE1].fqh = (Freq >> 4) + 1;
}
}
}
rubengar wrote:
interesting! if someone could give an example of code to make music or sounds would be great!!!!
Precisely. All I want is an example of how to program the VSU registers to generate tones and effects. I don’t care whether they freeze the game or not.
Well, you can look at gccVB’s audio.h file, and you can use the VSU register map
http://www.planetvb.com/modules/dokuwiki/doku.php?id=vsu_register_map
to get an idea of what is what.
I’ve asked about sound before, but got no answers. It’d be nice if someone who knows about sound programming would share their knowledge.
This is a FANTASTIC review! The best one I’ve seen of a Virtual Boy game. You speak clearly and the montage of various videos and pictures is very good. Keep it up!
Some errors though (all very minor ones): you fail to mention there are three more difficulty settings after you win a tournament on Hard, the American box is different than the Japanese one but you only show the latter, and you regularly refer to it as “Mario Tennis” rather than “Mario’s Tennis”.
It works in 9.21. The joy of using an old version… 🙂
But yeah, I use the Wand too.
gunpeiyokoifan wrote:
the day after Christmas will also mark the one year anniversary of me having my Virtual Boy in my game collection!
Same here.
Except it’ll be two years.
I find it too hard and frustrating at times. I think Galactic Pinball and Red Alarm are much better, but then again I haven’t beaten it yet.
Mine came sealed. And I knew it. And I opened it. (And it was a bit squashed anyway.)
If you’ve already got it, then why not play it? Might as well make use of it. And how do you know it wasn’t resealed?
Hedgetrimmer wrote:
It is good to hear of one so young enjoying retro, Spectrum was a top machine, had many lost hours programming & gaming on that back in the day…
Yeah. I’m 15, yet I started programming on a Spectrum, a 48K.
Don’t be depressed! You entered because of the fun and not the prize, right?
Hunter is interesting only because of its technology, but as a game it doesn’t offer anything yet.
DogP wrote:
Your DOS-based tracker sounds interesting… do you have a link?
My suggestion for audio is to use WAV and MIDI, because for musicians they’re the easiest to work with, even if they are hard to convert.
But there’s another option: I’ve written a simple DOS-based tracker that supports (a maximum of) four channels and plays them to the PC speaker. The file format is very simple and the four channels conveniently map to the VB’s four wave channels, leaving the sweep channel for Atari 2600-like sound effects and the noise channel for percussion or whatever.
Also, I prefer not being forced to use a specific IDE; EDIT.COM mostly does everything I want anyway. But I think it’s time gccVB comes precompiled for Windows again.
Protoman85 wrote:
So maybe now I can start doing Virtual Boy video reviews 😀
These days everybody with a videocamera wants to be a reviewer! 🙂
In my opinion, just do a series of videos showing what VB games are really like (but in depth) so people (particularly VB haters) will get enlightened.
No, not yet. The big problem is in the cartridge connector, which is non-standard and (I think) is covered by patents in some countries.
How much work was it to port your code to Basic?
Not much (but I’m not finished yet). Compare
while(Lives) // Gameplay loop
{
if(!Cycle)
{
MoveShip();
HeadsUpDisplay();
}
Cycle++;
LowBatteryIcon();
CollisionDetection();
PlayerControl();
ThingAI(); // Thing behavior
ProjectileAI(); // Projectile behavior
AutoRemoveThings(); // Removal of things outside the screen
AutoCreateThing(); // Creation of new things
Slowdown(); // Maintain a consistent game speed
if(!(Cycle % 32)) UpdateBackground();
}
with
DO WHILE Lives > 0 'Gameplay loop
IF Cycle = 32767 THEN Cycle = 0
IF Cycle = 0 THEN HeadsUpDisplay
Cycle = Cycle + 1
RedrawStuff 'Graphics code
CollisionDetection
PlayerControl
ThingAI 'Thing behavior
ProjectileAI 'Projectile behavior
AutoRemoveThings 'Removal of things outside the screen
AutoCreateThing 'Creation of new things
Slowdown 'Maintain a consistent game speed
IF Cycle AND 32 <> 0 THEN UpdateBackground
LOOP
or
int AutoRemoveThings ()
{
// Checks each thing's Y and removes it if it's outside the screen.
char i; // Thing number.
char j; // Object number.
for(i = 0; i <= kMaxThings; i++)
{
if(Thing[i].Used)
{
if(Thing[i].Y > 224)
{
Thing[i].Used = 0; // The thing is officially no longer used.
Thing[i].Direction = 0;
// Make its OBJs invisible.
for(j = 0; j <= 15; j++)
{
OBJ_SET_VIS(16 + j + (i << 4), 0);
}
}
}
}
}
with
SUB AutoRemoveThings
FOR i% = 0 TO kMaxThings
IF Thing(i%).Used THEN
IF Thing(i%).Y > 224 THEN 'Notice there's no need to hide OBJs - the thing simply won't be drawn if it's not used.
Thing(i%).Used = FALSE
Thing(i%).Direction = 0
END IF
END IF
NEXT i%
END SUB
That wouldn't have been my first choice, I would imagine it would have been easier to port it to DOS while staying in C.
Maybe. Maybe not. I'm much more skilled and productive in BASIC. Debugging with an interpreter is way easier. Both are procedural, imperative, structured languages anyway.
You might also consider writing it in Java. That way your code would be both cross-platform and web enabled.
I don't have an interest in Java (or any class-based object-oriented language) and I think the two advantages you mentioned are way overrated. It's like constructing a (human) language that only has features that exist in all languages and everybody can understand. You'd get nowhere.
what dialect of BASIC are you using?
QuickBASIC. In case I ever want to do a native Windows port I can easily do it in FreeBASIC.
DogP wrote:
Heh, and I’m not sure what “instructions” are needed for a link cable 😉 .
Nintendo would probably throw in a safety & precautions booklet and Nintendo Power propaganda 🙂
Fwirt: enjoy your shirt. (Wow, it rhymes!)
At least I don’t have a reason to be angry on myself, because I didn’t give Mandelbrot Explorer any points 🙂
OK, so how do I make it wait for the right time?