⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 m_jcode.asl

📁 一款KingB公司的语音编码解码程序
💻 ASL
📖 第 1 页 / 共 2 页
字号:
+                     1 ;------------------------------------------------------------------------------
+                     2 ;       Program : m_jcode.asm
+                     3 ;       Version : I
+                     4 ;       Date    : Sept 00
+                     5 ;       Purpose : For demo new adpcm algorithm (JCODE).
+                     6 ;               : using D/A output.
+                     7 ;       Resource :
+                     8 ;               Timer 1 : not used.
+                     9 ;               Timer 2 : speech sampling interrupt, 8k sampling rate.
+                    10 ;       Description :
+                    11 ;               Using D-version ICE target board.
+                    12 ;               MCU     : dual clock, 4MHz Crystal, 32768Hz Slow clock.
+                    13 ;               To play the voice, press any Port D key(s).
+                    14 ;       Usage   :
+                    15 ;               1. For demonstrate how to link with jadpcm.obj for JCODE
+                    16 ;                  voice output.
+                    17 ;               2. Function call inside nc_main.obj
+                    18 ;                  a. .tc_int()   - for initialize the variables.
+                    19 ;                  b. .tc_play() - calling within interrupt routine.
+                    20 ;                                        - a 7-bit encoded data is placed in
+                    21 ;                                        - a variable named as voice.
+                    22 ;               3. RAM used.
+                    23 ;                  Total of 15 bytes used.
+                    24 ;                  a. b_talk_end        - 0ffh : means the voice is being stopped.
+                    25 ;                                       - 0 : means the voice is being played.
+                    26 ;                  b. speechtpp,high,low    - 3 bytes, for storing the speech pointer.
+                    27 ;                  c. Other                 - see below RAM declaration.
+                    28 ;
+                    29 ;               4. Procedure
+                    30 ;                       a. turn on voc and pwmc.
+                    31 ;                       b. play head if nescessary (for d/a output).
+                    32 ;                       c. setup .speechtpp,high,low
+                    33 ;                       d. call .tc_int()
+                    34 ;                       e. setup timer 1 or 2 for speech sampling time.
+                    35 ;                       f. enable timer 1 or 2 for speech playing
+                    36 ;                       g. check b_talk_end to know when speech ends.
+                    37 ;
+                    38 ;--------------------------------------------------------------------------
+                    39 ;------------------------------
+                    40 ; constant declaration
+                    41 ;------------------------------
014C                 42 t8ksample       equ     332     ;(4M/1.5/8000)-1
0040                 43 silence_level   equ     40h
00FF                 44 pcm_end_code    equ     0xff
+                    45 
+                    46 ;------------------------------
+                    47 ; RAM declaration
+                    48 ;------------------------------
+B 00 01
+                    49 .area DATA(ABS,PAG)
0000                 50 acc:            .ds     1
0001                 51 mirr_flag:      .ds     1
+                    52 
+                    53 
+                    54 ;--------------------------------------------------------------
+                    55 ; The following RAM is used for JCODE encoding.
+                    56 ; It can be released when not in used JCODE voice playing.
+                    57 ;--------------------------------------------------------------
0002                 58 speechlow::                     .ds     1
0003                 59 speechhigh::                    .ds     1
0004                 60 speechtpp::                     .ds     1
0005                 61 b_talk_end::                    .ds     1
0006                 62 voice::                         .ds     1
+                    63 
0007                 64 v_int_tpl::                     .ds     1
0008                 65 v_int_tph::                     .ds     1
0009                 66 v_talk_data::                   .ds     1
000A                 67 x::                             .ds     1
000B                 68 p_voice::                       .ds     1
000C                 69 q_index::                       .ds     1
000D                 70 s_data::                        .ds     1
000E                 71 k::                             .ds     1
000F                 72 j::                             .ds     1
0010                 73 b_talk_high::                   .ds     1
+                    74 
+                    75 
+                    76 ;------------------------------
+                    77 ; main program
+                    78 ;------------------------------
+B 00 02
+                    79 .area   RCODE(ABS)
+                    80         org     0x00
0000 02 00 9E        81         br      main
+                    82         org     0x03
0003 02 00 01        83         br      ttrap1
+                    84         org     0x06
0006 02 00 02        85         br      int1
+                    86         org     0x09
0009 02 00 00        87         br      tc1
+                    88         org     0x0c
000C 02 00 04        89         br      tc2
+                    90         org     0x0f
000F 02 00 03        91         br      int2
+                    92 
0012                 93 .STARTUP::
+B 00 00
+                    94         .area   CODE
+                    95 
0000                 96 tc1:
0000 25              97         reti
0001                 98 ttrap1:
0001 26              99         rett
0002                100 int1:
0002 25             101         reti
0003                102 int2:
0003 25             103         reti
+                   104 
+                   105 ;----------------------------------------------------------------------
+                   106 ;
+                   107 ;       function : tc2() interrupt service function
+                   108 ;
+                   109 ;----------------------------------------------------------------------
0004                110 tc2:
+                   111 ;save acc., flag
0004 FD 00          112         sta     acc
0006 F0 22          113         lda     r_op1
0008 FD 01          114         sta     mirr_flag
+                   115 
+                   116 ;play JCODE routine
000A F1 05          117         lda     b_talk_end
000C A7 00          118         cmpe    #00
000E 07 00 18       119         brnz    tc2_ret
+                   120 
+                   121 ;call JCODE library
0011 20 00 00       122         call    .tc_play
0014 F1 06          123         lda     voice
0016 FC 34          124         sta     r_pwmc
+                   125 
0018                126 tc2_ret:
+                   127 ;restore acc. and flag
0018 F1 01          128         lda     mirr_flag
001A FC 22          129         sta     r_op1
001C F1 00          130         lda     acc
001E 25             131         reti
+                   132 
+                   133 ;------------------------------------------------------
+                   134 ;
+                   135 ;       function : play_head()
+                   136 ;
+                   137 ;------------------------------------------------------
001F                138 play_head:
001F F3 00          139         lda     #0
0021                140 play_head_l0:
0021 FC 34          141         sta     r_pwmc
0023 20 00 73       142         call    dummy_loop
0026 20 00 73       143         call    dummy_loop
0029 20 00 73       144         call    dummy_loop
002C 20 00 73       145         call    dummy_loop
002F 20 00 73       146         call    dummy_loop
0032 20 00 73       147         call    dummy_loop
0035 20 00 73       148         call    dummy_loop
0038 20 00 73       149         call    dummy_loop
003B 20 00 73       150         call    dummy_loop
003E 20 00 73       151         call    dummy_loop
0041 1F             152         inca
0042 A7 40          153         cmpe    #silence_level
0044 07 00 21       154         brnz    play_head_l0
0047                155 play_head_ed:
0047 24             156         ret
+                   157 
+                   158 ;------------------------------------------------------
+                   159 ;
+                   160 ;       function : play_tail()
+                   161 ;
+                   162 ;------------------------------------------------------
0048                163 play_tail:
0048 20 00 73       164         call    dummy_loop
004B 20 00 73       165         call    dummy_loop
004E 20 00 73       166         call    dummy_loop
0051 20 00 73       167         call    dummy_loop
0054 20 00 73       168         call    dummy_loop
0057 20 00 73       169         call    dummy_loop
005A 20 00 73       170         call    dummy_loop
005D 20 00 73       171         call    dummy_loop
0060 20 00 73       172         call    dummy_loop
0063 20 00 73       173         call    dummy_loop
0066 F1 06          174         lda     voice
0068 3F             175         deca
0069 FD 06          176         sta     voice
006B FC 34          177         sta     r_pwmc
006D A7 00          178         cmpe    #0
006F 07 00 48       179         brnz    play_tail
0072 24             180         ret
+                   181 
+                   182 ;------------------------------------------
+                   183 ;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -