Application Notes TITLE: EM61 Macro description Notes number : REVISED DATE REVISED VERSION APPLY TO CHIPS : : : APPLY TO SOFTWARE : AP-EM61-0004E-V2 20, Mar, 2002 2.01 Em610Macro_V20.def (EM61001 & Em61002) Em611Macro_V20.def (EM61100) Em612Macro_V20.def (EM61200 ~ Em61500) 2.0 Table list : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 MACRO name M_Clear_RAM _DAC1_TURN_ON _DAC2_TURN_ON M_DA1_VOL M_DA1_RANGE M_DA1_ON M_DA1_OFF M_DA2_VOL M_DA2_RANGE M_DA2_ON M_DA2_OFF M_Set_ROM_address M_PLAY_HEAD M_PLAY_Head_SUBCALL M_PLAY_TAIL M_PLAY_TAIL_SUBCALL M_STOP_PLAY M_STOP_PLAY_SUBCALL M_PLAY_SONG M_PLAY_SONG_SUBCALL M_PLAY?_TO M_INST_Change M_Play_tone Parameters VOL, RNG, ASSIGN VOL, RNG, ASSIGN Volume Range Channel Volume Range Channel Address DAC DAC Song_name Play_jump OrgInstCode, NewInstCode Channel, InstCode, InstTwfCode, volume, Frequency M_clear_RAM Description: Clear RAM from R13~R1F & R20~R3F at Bank0 to Bank7 Parameters: Nouse Example: M_Clear_RAM _DAC1_TURN_ON VOL, RNG, ASSIGN Description: Set DAC1 ON with Volume ; Rang & Enable Channel . Parameters: VOL : Control the DAC 1 volume. Data form 0 ~7 Write to MODE(RA) bit6,5,4 at R9=9. RNG : Define the DAC 1 mixer output dynamic range. Write to MODE(RA) b3, b2. 0 = mixer output b7 - b0 send to DAC 1 = mixer output b8 - b1 send to DAC 2 = mixer output b9 - b2 send to DAC ASSIGN : Assign the Enable channel, Max. are 4 channel. Write to IOC6, at R9=9 Select for DAC_Mch1 ; DAC_Mch2 ; DAC_Mch3 ; DAC_Mch4 ; DAC_Sch1 & DAC_Sch2, connect with “+” . Example: _DAC1_TURN_ON 7, 0, DAC_Mch1+DAC_Mch2+DAC_Mch3+DAC_Sch1 _DAC2_TURN_ON VOL, RNG, ASSIGN Description: Set DAC2 ON with Volume ; Rang & Enable Channel . Parameters: VOL : Control the DAC 2 volume. Data form 0 ~7 Write to MODE(RA) bit6,5,4 at R9=A. RNG : Define the DAC 2 mixer output dynamic range. Write to MODE(RA) b3, b2. 0 = mixer output b7 - b0 send to DAC 1 = mixer output b8 - b1 send to DAC 2 = mixer output b9 - b2 send to DAC ASSIGN : Assign the Enable channel, Max. are 4 channel. Write to IOC6, at R9=A Select for DAC_Mch1 ; DAC_Mch2 ; DAC_Mch3 ; DAC_Mch4 ; DAC_Sch1 & DAC_Sch2, connect with “+” . Example: _DAC1_TURN_ON 7, 0, DAC_Mch1+DAC_Mch2+DAC_Mch3+DAC_Sch1 M_DA1_VOL Volume Description: Set the DAC1 volume form 0 ~7 Parameters: Volume: Control the DAC 1 volume. Data form 0 ~7 Write to MODE(RA) bit6,5,4 at R9=9. Example: M_DA1_VOL 7 M_DA1_RANGE Range Description: Define the DAC 1 mixer output dynamic range. Parameters: Range: DAC 1 mixer output dynamic range Write to MODE(RA) b3, b2. form 0~2 0 = mixer output b7 - b0 send to DAC 1 = mixer output b8 - b1 send to DAC 2 = mixer output b9 - b2 send to DAC Example: M_DA1_RANGE 0 M_DA1_ON channel Description: Set DAC1 ON & Assign the Enable channel. Parameters: Channel : Assign the Enable channel. Max. are 4 channel. Write to IOC6, at R9=9 Select for DAC_Mch1 ; DAC_Mch2 ; DAC_Mch3 ; DAC_Mch4 ; DAC_Sch1 & DAC_Sch2, connect with “+” . Example: M_DA1_ON DAC_Mch1+DAC_Mch2+DAC_Mch3+DAC_Sch1 M_DA1_OFF Description: Close the DAC1. clear the MODE(RA) bit0=0 Parameters: No use Example: M_DA1_OFF M_DA2_VOL Volume Description: Set the DAC2 volume form 0 ~7 Parameters: Volume: Control the DAC 1 volume. Data form 0 ~7 Write to MODE(RA) bit6,5,4 at R9=A. Example: M_DA2_VOL 7 M_DA2_RANGE Range Description: Define the DAC 2 mixer output dynamic range. Parameters: Range: DAC 2 mixer output dynamic range Write to MODE(RA) b3, b2. form 0~2 0 = mixer output b7 - b0 send to DAC 1 = mixer output b8 - b1 send to DAC 2 = mixer output b9 - b2 send to DAC Example: M_DA2_RANGE 0 M_DA2_ON channel Description: Set DAC2 ON & Assign the Enable channel. Parameters: Channel : Assign the Enable channel. Max. are 4 channel. Write to IOC6, at R9=A Select for DAC_Mch1 ; DAC_Mch2 ; DAC_Mch3 ; DAC_Mch4 ; DAC_Sch1 & DAC_Sch2, connect with “+” . Example: M_DA2_ON DAC_Mch1+DAC_Mch2+DAC_Mch3+DAC_Sch1 M_DA2_OFF Description: Close the DAC2. clear the MODE(RA) bit0=0 Parameters: No use Example: M_DA2_OFF M_Set_ROM_address Address Description: Set the read voice ROM address Parameters: Address: Select the “_” +”label name”. The label name must include in address label file “~%%EM61.ADR” . Example: M_Set_ROM_address _H32 M_PLAY_HEAD DAC Description: Play the Head wave before first play sound. The macro will check first play or replay? If replay it will bypass play head macro. Parameters: DAC: define witch DAC do you want to play head ? 1 = Only DAC1 play head. 2 = Only DAC2 play head. 3 = Both DAC1 & DAC2 play head. Example: M_PLAY_HEAD 3 M_PLAY_Head_SUBCALL Description: Play Head macro’s sub call route. Must use with M_PLAY_HEAD macro. Parameters: no use Example: M_PLAY_TAIL DAC Description: Play the Tail wave after the last play sound. The macro will check first play or replay? If replay it will bypass play tail macro. Parameters: DAC: define witch DAC do you want to play tail ? 1 = Only DAC1 play tail. 2 = Only DAC2 play tail. 3 = Both DAC1 & DAC2 play tail. Example: M_PLAY_TAIL 3 M_PLAY_TAIL_SUBCALL Description: Play Tail macro’s sub call route. Must use with M_PLAY_TAIL macro. Parameters: no use Example: M_STOP_PLAY Description: Stop all channel play immediately Parameters: no use Example: M_STOP_PLAY M_STOP_PLAY_SUBCALL Description: Stop playing macro’s sub call route. Must use with M_STOP_PLAY macro. Parameters: no use Example: M_PLAY_SONG Song_name Description: Play the select melody song Parameters: Song_name: Select midi song name with “_” +”midi file name” Example: M_PLAY_SONG _little_bee (midi file = little_bee.mid) M_PLAY_SONG_SUBCALL Description: Play song macro’s sub call route. Must use with M_PLAY_SONG macro. Parameters: no use Example: M_PLAY?_TO PLAY_JUMP Description: Check if playing jump the define label Parameters: PLAY_JUMP: jump location if at playing. Example: M_PLAY?_TO Check_ playing M_INST_Change OrgInstCode, NewInstCode Description: Change the instrument code to another in a midi song playing. Parameters: OrgInstCode : Original inter Instrument code The inter Instrument code list at “project_name.VLG” file. Example: …… 1. Tone instrument list: 1(0x00) : 000 Acoustic Grand Piano 2(0x01) : 008 Celesta 3(0x02) : 011 Vibraphone …… NewInstCode : Change to New inter Instrument code. Example: M_INST_Change 0, 2 (It will change all the 000 inst (in these example is Acoustic Grand Pian) to 002 inst (in these example is Vibraphone) at any track in a midi song. M_Play_tone Channel, InstCode, InstTwfCode, Volume, Frequency Description: Play a single tone in define channel with define Instrument, Twf type, volume & play frequency. Parameters: Channel : define the play channel. Form 1 ~ 8. InstCode : define the inter Instrument code. Form 0 ~ x InstTwfCode : define the Twf type of the assign Instrument. Form 0~ x The Twf type code can refer the “project_name.VLG” . Example: …… Tone file: (Auto) C:\EMC\EMC61000\instlib\000_C3.TWF 9944 bytes (= 0 at 00inst) C:\EMC\EMC61000\instlib\000_C4.TWF 7640 bytes (= 1 at 00inst) C:\EMC\EMC61000\instlib\000_C5.TWF 6776 bytes (= 2 at 00inst) C:\EMC\EMC61000\instlib\000_C6.TWF 3416 bytes (= 3 at 00inst) C:\EMC\EMC61000\instlib\008_C4.TWF 1752 bytes (= 0 at 00inst) C:\EMC\EMC61000\instlib\011_C4.TWF 4184 bytes (= 0 at 00inst) C:\EMC\EMC61000\instlib\021_C4.TWF 1496 bytes (= 0 at 00inst) …. Volume : define the tone play volume, form 0 ~ 100 %. Frequency : define the tone plat frequency, to set the tone’s pitch. Yoy can refer the “em61playTone_freq_table.xls” file Example: M_Play_tone 1,0,1,100,16842