Category:Sound-kun BASIC
This page was last modified 14:45, 10 October 2021 by Mars2000you. Based on work by Gdx.

Contents

Description

Sound-kun BASIC is an MSX-BASIC extension with PSG/SCC driver, created by Yanagi and released in Mycom BASIC Magazine of November 1989. It can be used on any MSX system with at least 64kB RAM.

A cartridge with SCC/SCC+ soundchip or compatible is required to use fully Sound-kun BASIC. SCC Konami cartridges are usable but remember: Do not insert a cartridge with the MSX turned on!!!. However, safe options exist:

  • slotexpanders with switches
  • SCC cartridges modified with switch or converted to Megasram (aka ESE-RAM)
  • use Sound-kun on MSX emulator

You must enter BLOAD"SOUNDKUN.BIN", R to install the driver.

This extension is available HERE.

Instructions

The Sound-kun BASIC extension adds 11 new instructions. They allow you to add music to your Basic programs as the extension was programmed in assembler language.

Note: CALL can be replaced by the character underscore (_). A space is not required after this character. See CALL for more info.

Instruction Generation Function
CALL ALLOC MSX1 Allocate the memory size for a track
CALL ASSIGN MSX1 Set the track to play on a channel.
CALL CONTS MSX1 Continue music
CALL SCC MSX1 Select the slot of the SCC cartridge to use. SCC+ is auto-detected.
CALL SOUND MSX1 PSG/SCC enable
CALL PLAYS MSX1 Play music
CALL PSET MSX1 Define pattern data
CALL STOPS MSX1 Stop music
CALL TRK MSX1 Set a MML to a track
CALL VRAM MSX1 Put track data to VRAM
CALL WSET MSX1 Define timbre


MML

MML Samples

1000 CLEAR 1000:DEFINT A-Z
1010 _SOUND(1,1): ' _SCC(1)
1020 '
1030 FOR I=0 TO 2:_ALLOC(I,1024):_ASSIGN(I+3,I):NEXT I
1040 '
1050 FOR I=0 TO 1
1060 W$="":FOR J=0 TO 31:READ A$:W$=W$+A$+",":NEXT J:_WSET(I,W$)
1070 NEXT I
1080 '
1090 W$="" :FOR J=0 TO 31:READ A$:W$=W$+A$+",":NEXT J:_PSET(0,W$)
1100 '
1110 'PULSE(NORMAL) WAVE
1120 DATA  127, 127, 127, 127, 127, 127, 127, 127
1130 DATA  127, 127, 127, 127, 127, 127, 127, 127
1140 DATA -127,-127,-127,-127,-127,-127,-127,-127
1150 DATA -127,-127,-127,-127,-127,-127,-127,-127
1160 '
1170 'PULSE(SMALL) WAVE
1180 DATA  127, 127, 127, 127, 127,-127,-127,-127
1190 DATA -127,-127,-127,-127,-127,-127,-127,-127
1200 DATA -127,-127,-127,-127,-127,-127,-127,-127
1210 DATA -127,-127,-127,-127,-127,-127,-127,-127
1220 '
1230 ' ENV.PATTERN
1240 DATA 31, 30, 15, 15, 14, 14, 13, 13
1250 DATA 12, 12, 11, 11, 10, 10,  9,  9
1260 DATA  8,  8,  7,  7,  6,  6,  5,  5
1270 DATA  6,  6,  5,  5,  4,  4,  4,  4
1280 '
1290 ' MELODY 1
1300 A$="T150@0@V12L8Q7@S0O5[0" :_TRK(0,A$)
1310 A$="[G4G4GF#GAF4F4FEFG:" :_TRK(0,A$)
1320 A$="E-4E-4E-DE-FD1]" :_TRK(0,A$)
1330 A$="E-4E-4E-CE-FG1" :_TRK(0,A$)
1340 A$="A-A-A-A-A-A-A-A-G1" :_TRK(0,A$)
1350 A$=">CCCCCCCC<B1" :_TRK(0,A$)
1360 A$=">GFD<BGFD<BG>R8R4R2]" :_TRK(0,A$)
1370 '
1380 ' MELODY 2
1390 A$="T150@0@V12L8Q7@S0O5[0" :_TRK(1,A$)
1400 A$="[E4E4ED#EFD4D4DC#DE-:" :_TRK(1,A$)
1410 A$="C4C4C<B>CD<B1>]" :_TRK(1,A$)
1420 A$="C4C4C<A->CD<B1>" :_TRK(1,A$)
1430 A$="CCCCCCCC<B1>" :_TRK(1,A$)
1440 A$="A-A-A-A-A-A-A-A-G1" :_TRK(1,A$)
1450 A$="R1R1]" :_TRK(1,A$)
1460 '
1470 ' BASS
1480 A$="T150@1@V10L8Q5O3[0" :_TRK(2,A$)
1490 A$="[CG>C<GCG>C<G<B->FB-F<B->FB-F:" :_TRK(2,A$)
1500 A$="<A->E-A-E-<A->E-A-E-<G>DGD<G>DGD]" :_TRK(2,A$)
1510 A$="<A->E-A-E-<A->E-A-E-<G>DGD<G>DGD" :_TRK(2,A$)
1520 A$="<F#F#F#F#F#F#F#F#G>DGD<G>DGD" :_TRK(2,A$)
1530 A$="<F#F#F#F#F#F#F#F#G>DGD<G>DGD" :_TRK(2,A$)
1540 A$="R1R8<F#GF#GG#AB>]" :_TRK(2,A$)
1550 '
1560 _PLAYS
1570 END
1580 '
1590 '========================
1600 ' DRAGON BUSTER (C)NAMCO
1610 ' SCC-VERSION  by ITOCHI
1620 '========================

Note: Remove the apostrophe from the line 1010 if you use an SCC cartridge in the slot 1 instead of SCC+. If the SCC cartridge is inserted in slot 2, use _SCC(2).

Source: MyCom Basic Magazine 1989-12

100 ' R-Type music for Sound-kun
110 CLEAR 1000:_SOUND:' _SCC(1)
120 FOR I=0 TO 1:READ A$,B$:A$=A$+","+B$:_PSET(I,A$):NEXT
130 '
140 '     +0  +1  +2  +3  +4  +5  +6  +7  +8  +9  +A +13  +C  +D  +E  +F
150 DATA" 31, 31, 14, 15, 14, 13, 12, 11, 10,  9,  9,  8,  8,  7,  7,  6":'No,0
160 DATA"  6,  5,  5,  4,  4,  3,  3,  2,  2,  1,  1,  0,  0,  0,  0,  0"
170 '
180 DATA" 11, 02, +2, +1,  0, -1, -2, -2, -1,  0, +1, +2,  0,  0,  0,  0":'No,1
190 DATA" 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0"
200 '
210 FOR I=0 TO 2:_ALLOC(I,2000):_ASSIGN(I,I):NEXT
220 A0$="t150 l16 q6 @k8 @h1,0,0,0"
230 B0$="t150 l16 @s0,0"
240 C0$="t150 l8 s9 m15000"
250 A1$="o5r2v14ed#<b1&r4."
260 B1$="[ o5@v12ba# ag f#f ed <ba# ag f#f ed ]"
270 F1$="o2eereer":C1$="["+F1$+"]"
280 A2$="r2b&a#&g1&r4."
290 A3$="q0{o4cdd#ed#d}lo3 q6 b1"
300 B3$="  {o3cdd#ed#d}o5@v12ba#agagf#egf#eco4b4"
310 C3$="[ o1bbrbbr ]"
320 A4$="o5e1 d#2.c8o4b1^8&b1"
330 B4$="["+B1$+"]"
340 C4$="["+C1$+"]"
350 AS$="o5d1 c#2. o4b8a8"
360 F5$="o2ddrddr":F6$="o2c#c#rc#c#r":C5$=F5$+F6$
370 A6$="b1&b1"
380 A7$="g1 a2r4 f#8e1^8&e1"
390 C7$=F1$+F5$+C1$
400 A8$="b1 o5d2. o4b8a8"
410 C8$=F1$+F5$
420 B9$="g#aa#bo5cc#dd#eff#gg#aa#b g#aa#bo6cc#dd#eff#gg#abo7c"
430 M$=A0$+"[0"+A1$+A2$+A3$:_TRK(0,M$)
440 M$=A4$+A5$+"["+A6$+":" :_TRK(0,M$)
450 M$=A7$+A8$+"]]"        :_TRK(0,M$)
460 M$=B0$+"[0[["+B1$+"]:" :_TRK(1,M$)
470 M$=B3$+B4$+"]"         :_TRK(1,M$)
480 M$=B4$+B1$             :_TRK(1,M$)
490 M$=B9$+"]"             :_TRK(1,M$)
500 M$=C0$+"[0"+C1$+C1$    :_TRK(2,M$)
510 M$=C3$+C4$+C5$         :_TRK(2,M$)
520 M$=C3$+C7$+C8$+C3$+"]" :_TRK(2,M$)
530 _PLAYS

Note: Same remark as for program above (line 110 instead of 1010)

Source: MyCom Basic Magazine 1989-11

Links

This category currently contains no pages or media.