Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - SMS devkit

Reply to topic Goto page Previous  1, 2
Author Message
  • Joined: 28 Jan 2017
  • Posts: 429
  • Location: Málaga, Spain
Reply with quote
About MBMLib example
Post Posted: Thu Aug 11, 2022 7:39 pm
Hi everyone!

Let's see...

I am testing MBMLib and the possibility to use both MBMLib and PSGLib, using the first if the console has FM sound, getting back to the PSG library if not.

I took a mbm file (MASTLAMP.MBM) from the moonblaster 1.4 dsk and loaded in my (current) in development new game (which should be ready for the next competition) but does not work at all. It begins playing some odd sounds and at two-three seconds the game hangs.

I have tested some other files and did not get any success.

Can someone upload a demo with a mbm file and the source code???

Some additional insights?

Thanks!!!!
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3262
  • Location: Torino, then London, now Stockholm
Reply with quote
Post Posted: Thu Aug 11, 2022 7:58 pm
This is the code I used to test MBMlib while wrapping it into C language, you can use it as a very simple example.
Remove the parts about the SFX if you don't need that.

#include "../SMSlib/SMSlib.h"
#include "../MBMlib/MBMlib.h"
#include "assets2banks.h"

#define theModule  example_mbm
#define theSFX     sfx_example_bin

void main (void) {

  if (SMS_GetFMAudioCapabilities())
    SMS_EnableAudio (SMS_ENABLE_AUDIO_FM_ONLY);

  MBMPlay(theModule);

  for (;;) {
    SMS_waitForVBlank();
    MBMFrame();
    MBMSFXFrame();

    unsigned char kp=SMS_getKeysPressed();

    if (kp & PORT_A_KEY_RIGHT) {
      if (MBMGetStatus())
        MBMStop();
      else
        MBMResume();
    } else if (kp & PORT_A_KEY_LEFT) {
      if (MBMGetStatus())
        MBMStop();
      else
        MBMPlay(theModule);
    } else if (kp & PORT_A_KEY_DOWN) {
      if (MBMGetStatus())
        MBMFadeOut(15);
    } else if (kp & PORT_A_KEY_UP) {
      if (MBMGetStatus())
        MBMCancelLoop();
    } else if (kp & PORT_A_KEY_1) {
      MBMSFXPlay(theSFX);
    } else if (kp & PORT_A_KEY_2) {
      if (MBMSFXGetStatus())
        MBMSFXStop();
      else
        MBMSFXPlayLoop(theSFX);
    }

  }
}
  View user's profile Send private message Visit poster's website
  • Joined: 29 Mar 2012
  • Posts: 774
  • Location: Spain
Reply with quote
Post Posted: Fri Aug 12, 2022 7:22 am
I also have a jukebox kind of demo working. If you need it I can provide you with the code.
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3262
  • Location: Torino, then London, now Stockholm
Reply with quote
Post Posted: Fri Aug 12, 2022 8:01 am
also note that you have to page in the module asset before MBMFrame calls (as with PSGlib) but you need to do it also before MBMPlay (or MBMPlayNoRepeat) calls.
  View user's profile Send private message Visit poster's website
Reply to topic Goto page Previous  1, 2



Back to the top of this page

Back to SMS Power!