1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MSX STRTMS

Last updated at Posted at 2018-07-19

注意
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);
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?