<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="http://smartbasic.net/forum/app.php/feed/topic/57" />

	<title>SmartBASIC - A Coleco Adam Forum</title>
	<subtitle>Let's Talk Adam</subtitle>
	<link href="http://smartbasic.net/forum/index.php" />
	<updated>2019-12-07T07:21:28-04:00</updated>

	<author><name><![CDATA[SmartBASIC - A Coleco Adam Forum]]></name></author>
	<id>http://smartbasic.net/forum/app.php/feed/topic/57</id>

		<entry>
		<author><name><![CDATA[lotonah]]></name></author>
		<updated>2019-12-07T07:21:28-04:00</updated>

		<published>2019-12-07T07:21:28-04:00</published>
		<id>http://smartbasic.net/forum/viewtopic.php?t=57&amp;p=198#p198</id>
		<link href="http://smartbasic.net/forum/viewtopic.php?t=57&amp;p=198#p198"/>
		<title type="html"><![CDATA[Re: Coding on the CV]]></title>

		
		<content type="html" xml:base="http://smartbasic.net/forum/viewtopic.php?t=57&amp;p=198#p198"><![CDATA[
I gotta say, that's a pretty epic reply  <img class="smilies" src="http://smartbasic.net/forum/images/smilies/icon_e_smile.gif" width="15" height="17" alt=":)" title="Smile"><br><br>Someday (I keep telling myself that so I don't commit harikari) I'm gonna sit down and get back to programming... this will help a lot!<p>Statistics: Posted by <a href="http://smartbasic.net/forum/memberlist.php?mode=viewprofile&amp;u=56">lotonah</a> — Sat Dec 07, 2019 6:21 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[pearsoe]]></name></author>
		<updated>2019-11-20T19:27:53-04:00</updated>

		<published>2019-11-20T19:27:53-04:00</published>
		<id>http://smartbasic.net/forum/viewtopic.php?t=57&amp;p=196#p196</id>
		<link href="http://smartbasic.net/forum/viewtopic.php?t=57&amp;p=196#p196"/>
		<title type="html"><![CDATA[Re: Coding on the CV]]></title>

		
		<content type="html" xml:base="http://smartbasic.net/forum/viewtopic.php?t=57&amp;p=196#p196"><![CDATA[
Hi Milli,<br><br>I'll try to explain Colecovision sound programming as best as I can.  The three best resources I have found are:<br>1. "Colecovision Coding Guide" by Daniel Bienvenu starting at page 198. Good documentation on sound structure.<br>2. "Official Colecovision Programming Manual" section 7 Sound Generation<br>3. Disassembling Colecovision games that actually use OS7 calls, a lot of them do not.<br><br>Here are the equates I'll reference:<br><br>SOUND_INIT:EQU1FEEh;B=concurrent voices+effects, HL=song table<br>SOUND_MGR:EQU1FF4h<br>PLAY_IT:        EQU1FF1h;B=Song number<br>PLAY_SONGS:EQU1F61h<br>TURN_OFF_SOUND:EQU1FD6h<br>NUM_SOUND_DATA_AREAS:EQU5<br><br>Generating sound on the Colecovision using OS7 requires 4 steps:<br><br>1. Initialization<br>2. Sound Definitions<br>3. VDP routines<br>4. Playing (starting) a sound<br><br>1. Initialization<br><br>; Initialize Sound<br>CALLTURN_OFF_SOUND<br><br>LDB,NUM_SOUND_DATA_AREAS;number of active voices+effects, minimum of 4 for 4 channel sound<br>LDHL,SOUND_TABLE;pointer to memory location where you will define your sounds to their data areas, see Sound Definitions below<br>CALLSOUND_INIT<br><br>2. Sound definitions.<br><br>You can have multiple sounds use the same data area. Playing a sound in the same data area will of course stop the sound that was previously playing.  Each sound data area requires 10 bytes of RAM.<br><br>SOUND_TABLE:;the pointer used in initialization<br>        ;pointer to sound data,ram sound/channel data area<br>DW      DATA_SOUND_01H,72E0h   ; click sound<br>DW      DATA_SOUND_02H,72EAh   ; music channel 1<br>DW      DATA_SOUND_03H,72F4h   ; music channel 2<br>DW      DATA_SOUND_04H,72FEh   ; music channel 3<br>DW      DATA_SOUND_05H,7308h   ; music channel 4<br>DW 0,0;table must end with this<br><br>DATA_SOUND_01H:<br>DB      03H,00H,66H,04H,00H,00H,75H,11H<br>        DB      10H;sound stops after one play, no repeat<br><br>You would have one of these for each sound as defined in your SOUND_TABLE. So for this example I would need DATA_SOUND_02H, DATA_SOUND_03H, DATA_SOUND_04H and DATA_SOUND_05H also.<br><br>3. VDP routine<br><br>During your VDP Interupt routing you must call two OS7 sound routines (PLAY_SONGS and SOUND_MGR) in a specific order to play your sounds/music and keep them playing.<br><br>Example VDP routine:<br><br>VDPINT:<br>;Save all registers<br>PUSHAF<br>PUSHBC<br>PUSHDE<br>PUSHHL<br>PUSHIX<br>PUSHIY<br>EXAF,AF'<br>PUSHAF<br>EXX<br>PUSHBC<br>PUSHDE<br>PUSHHL<br>;sound routines<br>CALLPLAY_SONGS<br>CALLSOUND_MGR<br>;Now restore everything<br>POPHL<br>POPDE<br>POPBC<br>EXX<br>POPAF<br>EXAF,AF'<br>POPIY<br>POPIX<br>POPHL<br>POPDE<br>POPBC<br>;<br>INA,(0BFh);Side effect allows another NMI to happen<br>;<br>POPAF<br>;<br>RETN<br><br>4. Playing (starting) a sound<br><br>In order to start a sound playing you would call the PLAY_IT OS7 routine. If you wanted to play a 4 channel song you would make 4 calls to PLAY_IT with each call starting one of the channels.<br><br>;example to play a simple sound<br>LDB,1;start sound 1<br>CALLPLAY_SOUND_IN_B;play sound in B register<br><br>;example to play a 4 channel song<br>LDB,2;start music channel 1<br>CALLPLAY_SOUND_IN_B;play sound in B register<br>LDB,3;start music channel 2<br>CALLPLAY_SOUND_IN_B;play sound in B register<br>LDB,4;start music channel 3<br>CALLPLAY_SOUND_IN_B;play sound in B register<br>LDB,5;start music channel 4<br>CALLPLAY_SOUND_IN_B;play sound in B register<br><br>;--------------------------------------------------------<br>;Input: B song to play<br>PLAY_SOUND_IN_B:<br>        PUSH    AF<br>        PUSH    BC<br>        PUSH    DE<br>        PUSH    HL<br>        PUSH    IX<br>        PUSH    IY<br>        CALL    PLAY_IT<br>        POP     IY<br>        POP     IX<br>        POP     HL<br>        POP     DE<br>        POP     BC<br>        POP     AF<br>        RET<p>Statistics: Posted by <a href="http://smartbasic.net/forum/memberlist.php?mode=viewprofile&amp;u=59">pearsoe</a> — Wed Nov 20, 2019 6:27 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Milli]]></name></author>
		<updated>2019-11-14T09:15:30-04:00</updated>

		<published>2019-11-14T09:15:30-04:00</published>
		<id>http://smartbasic.net/forum/viewtopic.php?t=57&amp;p=194#p194</id>
		<link href="http://smartbasic.net/forum/viewtopic.php?t=57&amp;p=194#p194"/>
		<title type="html"><![CDATA[Coding on the CV]]></title>

		
		<content type="html" xml:base="http://smartbasic.net/forum/viewtopic.php?t=57&amp;p=194#p194"><![CDATA[
I have recently begun coding games for the CV. It basically is the same as coding for the Adam with very limited RAM (less than 1kb) and you use the OS7 ROM instead of EOS. Is anyone else doing this? I am looking for examples of sound in Assembly code.<p>Statistics: Posted by <a href="http://smartbasic.net/forum/memberlist.php?mode=viewprofile&amp;u=2">Milli</a> — Thu Nov 14, 2019 8:15 am</p><hr />
]]></content>
	</entry>
	</feed>
