Difference between revisions of "LVGM"

From MSX Game Library

(Created page with "<pre> ============================================================================== HEADER (4 bytes) =======================================================================...")
 
Line 147: Line 147:
 
Not used: 91, 93, 95, 97, 99~9F, C1~CF
 
Not used: 91, 93, 95, 97, 99~9F, C1~CF
 
</pre>
 
</pre>
 +
[[Category:Format]]

Revision as of 23:36, 15 December 2023

==============================================================================
 HEADER  (4 bytes)
==============================================================================
	nn nn		"LVGM"            Light-VGM identifier
	nn			Options
				7 6 5 4 3 2 1 0
				│ │ │ │     │ └── Frequency (0: 60 Hz, 1: 50 Hz)
				│ │ │ │     └──── Loop data included
				└─┴─┴─┴────────── File format version (0)
	nn			Devices
				7 6 5 4 3 2 1 0
				│   │ │ │ │ │ └── Include PSG data (AY-3-8910)
				│   │ │ │ │ └──── Include MSX-MUSIC data (YM2413/OPLL)
				│   │ │ │ └────── Include MSX-AUDIO data (Y8950/OPL1+ADPCM)
				│   │ │ └──────── Include SCC data (K051649)
				│   │ └────────── Include SCC+ data (K052539)
				│   └──────────── Include secondary PSG data
				└──────────────── Include Moonsound data (YMF278/OPL4)


==============================================================================
 COMMON DATA  (D0~FF)
==============================================================================

	Opcode			Action
------------------------------------------------------------------------------
	Dn				Wait n+1 cycles (1~16)
..............................................................................
	En rr vv[]		Copy n+3 bytes (3~18) from register #rr
..............................................................................
	F0				Start of PSG chunk (default when not defined)
	F1				Start of MSX-MUSIC chunk
	F2				Start of MSX-AUDIO chunk
	F3				Start of SCC chunk
	F4				Start of SCC+ chunk
	F5				Start of secondary PSG chunk
	F7				Start of Moonsound chunk

	FD nn rr vv[]	Copy nn bytes (0~255) from register #rr

	FE nn nn    	End of song with loop
	FF          	End of song (without loop)
..............................................................................
					Not used: F6, F8~FC


==============================================================================
 PSG DATA  (00~CF)
==============================================================================

	Opcode			Action
------------------------------------------------------------------------------
 Tone Period
------------------------------------------------------------------------------
	00 nn			R#0	= nn
	1n				R#1	= n
	02 nn			R#2	= nn
	2n				R#3	= n
	04 nn			R#4	= nn
	3n				R#5	= n
------------------------------------------------------------------------------
 Noise Period
------------------------------------------------------------------------------
	4n				R#6	= n
	5n				R#6	= n | 0x10
------------------------------------------------------------------------------
 Mixer
------------------------------------------------------------------------------
	07 nn			R#7	= nn
------------------------------------------------------------------------------
 Tone Amplitude
------------------------------------------------------------------------------
	6n				R#8 = n	
	7n				R#8 = n | 0x10
	8n				R#9 = n
	9n				R#9 = n | 0x10
	An				R#A = n
	Bn				R#A = n | 0x10
------------------------------------------------------------------------------
 Envelope Period
------------------------------------------------------------------------------
	0B nn			R#11 = nn
	0C nn			R#12 = nn
------------------------------------------------------------------------------
 Envelope Shape
------------------------------------------------------------------------------
	Cn				R#13 = n
..............................................................................
					Not used: 01, 03, 05, 06, 08, 09, 0A, 0D~0F


==============================================================================
 MSX-MUSIC DATA  (00~CF)
==============================================================================

	Opcode			Action
------------------------------------------------------------------------------
	rr nn			Register #rr (00~38) set to nn

	40 nn[8]		User Tone (copy 8 bytes from R#0)
	50 nn[9]		F-Number  (copy 9 bytes from R#10)
	60 nn[9]		Setting   (copy 9 bytes from R#20)
	70 nn[9]		Inst/col  (copy 9 bytes from R#30)
..............................................................................
					Not used: 08~0D, 19~1F, 29~2F, 39~3F, 41~4F, 
					 51~5F, 61~6F, 71~CF


==============================================================================
 MSX-AUDIO DATA  (00~CF)
==============================================================================

	Opcode			Action
------------------------------------------------------------------------------
	rr nn			Register #rr (00~C8) set to nn

	1F nn[8]		User Tone 1 (copy 8 bytes in 20,23,40,43,60,63,80,83)
	2F nn[8]		User Tone 2 (copy 8 bytes in 21,24,41,44,61,64,81,84)
	3F nn[8]		User Tone 3 (copy 8 bytes in 22,25,42,45,62,65,82,85)
	4F nn[8]		User Tone 4 (copy 8 bytes in 28,2B,48,4B,68,6B,88,8B)
	5F nn[8]		User Tone 5 (copy 8 bytes in 29,2C,49,4C,69,6C,89,8C)
	6F nn[8]		User Tone 6 (copy 8 bytes in 2A,2D,4A,4D,6A,6D,8A,8D)
	7F nn[8]		User Tone 7 (copy 8 bytes in 30,33,50,53,70,73,90,93)
	8F nn[8]		User Tone 8 (copy 8 bytes in 31,34,51,54,71,74,91,94)
	9F nn[8]		User Tone 9 (copy 8 bytes in 32,35,52,55,72,75,92,95)
..............................................................................
					Not used: 13~14, 1B~1E, 26~27, 2E, 36~3E, 46~47, 
					 4E, 56~5E, 66~67, 6E, 76~7E, 86~87, 8E, 96~9E, 
					 A9~AF, B9~BC, BE~BF, C9~CF


==============================================================================
 SCC/SCC+ DATA  (00~CF)
==============================================================================

	Opcode			Action
------------------------------------------------------------------------------
	rr nn			Register #rr (00h~C0h) set to nn

	90 nn[32]		Copy 32 bytes to channel 1 waveform (9800h)
	92 nn[32]		Copy 32 bytes to channel 2 waveform (9820h)
	94 nn[32]		Copy 32 bytes to channel 3 waveform (9840h)
	96 nn[32]		Copy 32 bytes to channel 4 waveform (9860h)
	98 nn[32]		Copy 32 bytes to channel 5 waveform (98A0h) (SCC+ only)
..............................................................................
					Not used: 91, 93, 95, 97, 99~9F, C1~CF