RoboSOP - SOP player on OPL4 using Fusion-C

Страница 1/2
| 2

By ToriHino

Paladin (855)

Аватар пользователя ToriHino

15-02-2019, 20:06

To get started with the FUSION-C library (and also since we can never have enough music file format replayers on the MSX :P ), i'm working on a SOP file replayer.
SOP files are created by Note, a Korean FM Tracker by Lee Ho Bum (sopepos) on the PC for OPL2/3 sound chips. It supports up to 20 channels and 4OP instruments.

This video shows a very early build. The program is completely written in C, using SDCC and the FUSION-C library. Timing is still very flaky (quick and dirty connected to the VDP interrupt for now, just to get it running), also not all Note effects are complete yet. It runs sort of ok on a Turbo-R, more optimization is needed to get it running on slower machines.

Для того, чтобы оставить комментарий, необходимо регистрация или !login

By Giangiacomo Zaffini 2

Champion (286)

Аватар пользователя Giangiacomo Zaffini 2

16-02-2019, 14:30

Pretty neat! Please keep updating us about Your project!

By ericb59

Paragon (1102)

Аватар пользователя ericb59

16-02-2019, 16:50

It's really great !

Which MSX Sound chip is used to play sounds ?

EDIT : Ok answer is in the topic's title ! OPL4 Question

By journey

Hero (575)

Аватар пользователя journey

16-02-2019, 17:59

WOW!!!!

By ToriHino

Paladin (855)

Аватар пользователя ToriHino

19-02-2019, 23:10

Update: now all controls are supported (especially the stereo panning makes quite a difference), and replay is now based on the OPL4 timer interrupt

Video
Video

By Robosoft

Expert (110)

Аватар пользователя Robosoft

19-02-2019, 23:20

Nice! Timing and sound much beter now Smile

By yzi

Champion (444)

Аватар пользователя yzi

20-02-2019, 12:29

What does the OPL4 timer interrupt code look like, can you post a copy/pasteable example? Smile I never bothered trying to implement a timer interrupt in my own player.

By ericb59

Paragon (1102)

Аватар пользователя ericb59

20-02-2019, 16:33

Very very nice. Congratulation !

does this player can be used inside a game ?

By ToriHino

Paladin (855)

Аватар пользователя ToriHino

20-02-2019, 20:10

yzi wrote:

What does the OPL4 timer interrupt code look like, can you post a copy/pasteable example? Smile I never bothered trying to implement a timer interrupt in my own player.

Sure, actually it is not that different from a VDP interrupt routine. In princpiple it is setting a value in the timer register of one of the two timers provided by the OPL4 (or both if you want of course). Activate the timer and in the ISR clear the interrupt flag. In this player i disabled the VDP interrupt, however if that is still active you have to check in the ISR whether the interrupt was generated by the OPL or the VDP.

The register to be used for T1 and T2 can be foud in the OPL 4 application manual on the MSX Assembly Page. You can also find in there how to calculate the values for either T1 or T2.

As an example, part of the code:
For setting up the timer and activating it (of course after setting up the ISR):

#define OPL4_REG  0xC4
#define OPL4_DATA 0xC5
#define OPL4_REG2 0xC6

#define OPL4_TIMER1_COUNT 0x02
#define OPL4_TIMER2_COUNT 0x03

void FT_WriteOpl1(byte addr, byte value)
{
    byte busy = 0;

    do
    {
        busy = InPort(OPL4_REG);
    } while(busy & 1);
    OutPort(OPL4_REG, addr);
    do 
    {
        busy = InPort(OPL4_REG);
    } while(busy & 1);
    OutPort(OPL4_DATA, value);   
}

void FT_SetTimer2Count(byte value)
{
    FT_WriteOpl1(OPL4_TIMER2_COUNT, value);
}

void FT_SetTimer2State(boolean state)
{
    FT_WriteOpl1(4, (state) ? 0x02 : 0x00);
}

And (part of) the ISR:

void FT_InterruptHandler(void) 
{
    .
    .
    FT_WriteOpl1(4, 0x80); // Reset interrupt flag
    .
    .
}

By ToriHino

Paladin (855)

Аватар пользователя ToriHino

20-02-2019, 20:16

ericb59 wrote:

Very very nice. Congratulation !

does this player can be used inside a game ?

Probably not, current implementation takes already most of the CPU cycles. In fact i still need to do some more optimization to get it running full speed on a regular MSX2, although the current version is already quite a bit faster than the initial version.

By ToriHino

Paladin (855)

Аватар пользователя ToriHino

01-03-2019, 20:33

Again some tweaks and improvements made to RoboSOP:
RoboSOP playing Triumph
RoboSOP playing Hope

Still some things left to do:
- Automatic replay speed detection not always working, still often need to override the 'ticks per beat'
- Memory allocation still only in main mapper
- Still not fast enough for regular MSX2 :P

Страница 1/2
| 2