Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

MSX STRTMS

More than 1 year has passed since last update.

注意
BASICのPLAY文との共存は考慮していません。

参考
6章 内部ルーチン - MSX Datapack wiki化計画
The MSX Red Book Revised - P.P.I.

play.c
/*
z88dk / WebMSX
zcc +msx -lndos -create-app -bnplay play.c
*/

#define BYTE unsigned char

void strtms(void *qcb)
{
#asm
loop:
    ld  a, ($fb3f)  ; MUSICF
    or  a
    jr  nz, loop
    di
    ld  de, $f959   ; QUETAB
    ld  bc, 6*3
    ldir
    ld  a, %001
    ld  ($fb40), a  ; PLYCNT
    call    $0099       ; STRTMS
    ei
#endasm
}

typedef struct {
    BYTE putoff;
    BYTE getoff;
    BYTE backup;
    BYTE len;
    BYTE *queue;
} QCB;

void main()
{
    QCB qcb[3] = {
        { 0x7f, 0, 0, 0x7f },
        { 0x7f, 0, 0, 0x7f },
        { 0x7f, 0, 0, 0x7f }
    };
    BYTE qa[128] = {
        0,
        0x60, 0x1e, 0x88, 0x01, 0xac,   // 3byte 30tick v8 tone=$1ac
        0x60, 0x1e, 0x88, 0x01, 0x7d,   // 3byte 30tick v8 tone=$17d
        0x60, 0x1e, 0x88, 0x01, 0x53,   // 3byte 30tick v8 tone=$153
        0xff };
    BYTE qb[128] = { 0, 0xff };
    BYTE qc[128] = { 0, 0xff };

    qcb[0].queue = qa;
    qcb[1].queue = qb;
    qcb[2].queue = qc;

    strtms(qcb);
}
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away