eSpeak NG is an open source speech synthesizer that supports more than hundred languages and accents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

assemb 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. ; 32 bit version
  2. ; SWI numbers
  3. OS_File * &8
  4. OS_Module * &1e
  5. XOS_AddCallBack * &20054
  6. XOS_RemoveCallBack * &2005f
  7. GET h.RegNames
  8. EXPORT DMA_Handler
  9. EXPORT AddSineWaves
  10. IMPORT |callback_entry|
  11. IMPORT |sound_entry|
  12. IMPORT |sin_tab|
  13. AREA Assemb , CODE, READONLY
  14. ; pointers to data items
  15. ADR_callback_entry
  16. DCD callback_entry
  17. ADR_sound_entry
  18. DCD sound_entry
  19. ADR_sin_tab
  20. DCD sin_tab
  21. DMA_Handler
  22. ;**********
  23. ; fill the sound buffer of the linear sound handler
  24. ; preserve r11,r12,r13 (fp,ip,sp)
  25. MOV r5,ip ; need to save ip
  26. MOV ip,sp ;set up a stack
  27. STMFD sp!, {fp,ip,lr}
  28. STMFD sp!, {r5}
  29. MOV r12,r0 ; put the module_data word in r12
  30. BL sound_entry ; call C function through veneer in CMHG
  31. ; returns with r0=1 set callback, r1=module_data address
  32. CMP r0,#1
  33. BNE DMA_return
  34. ;---------
  35. TEQ pc,pc
  36. MRSEQ r8, CPSR ; 32bit version of call SWI from IRQ mode
  37. MOVNE r8,pc
  38. ORR r9,r8,#3
  39. MSREQ CPSR_c, r9
  40. TEQNEP r9,#0
  41. NOP
  42. STR r14, [r13,#-4]!
  43. ;---------
  44. ; r1=module_data address
  45. LDR r0,ADR_callback_entry ; call C function through CMHG veneer
  46. SWI XOS_AddCallBack
  47. ;---------
  48. LDR r14, [r13],#4 ; 32bit version of 'reenter original processor mode'
  49. TEQ pc,pc
  50. MSREQ CPSR_c, r8
  51. TEQNEP r8,#0
  52. NOP
  53. ;---------
  54. DMA_return
  55. LDMFD sp!,{ip}
  56. LDMFD sp, {fp,sp,pc}
  57. AddSineWaves
  58. ;total += AddSineWaves(waveph, h_switch_sign, maxh, harmspect);
  59. ; using this assembler routine increases overall speed by about 7.5%
  60. ; define the USE_ASSEMBLER_1 macro in speech.h to enable this routine
  61. ; input: r0=waveph r1=h_switch_sign r2=maxh r3=harmspect
  62. ; local: r5=sin_tab r6=total r7=h r8=theta
  63. ; return(total)
  64. MOV ip,sp
  65. STMFD sp!, {r5-r9,ip,lr}
  66. LDR r5,ADR_sin_tab
  67. MOV r6,#0 ; total = 0
  68. MOV r0,r0,LSL #16
  69. MOV r8,r0 ; theta = waveph
  70. MOV r7,#1
  71. as1
  72. MOV ip,r8,LSR #21
  73. LDR r9,[r5,ip,LSL #1] ; sin_tab[theta >> 5]
  74. MOV r9,r9,LSL #16
  75. MOV r9,r9,ASR #16
  76. LDR ip,[r3,r7,LSL #2] ; harmspect[h]
  77. MLA r6,r9,ip,r6
  78. ADD r8,r8,r0 ; theta += waveph
  79. ADD r7,r7,#1 ; h++
  80. CMP r7,r1
  81. BLE as1
  82. RSB r6,r6,#0 ; change sign
  83. as2
  84. MOV ip,r8,LSR #21
  85. LDR r9,[r5,ip,LSL #1] ; sin_tab[theta >> 5]
  86. MOV r9,r9,LSL #16
  87. MOV r9,r9,ASR #16
  88. LDR ip,[r3,r7,LSL #2] ; harmspect[h]
  89. MLA r6,r9,ip,r6
  90. ADD r8,r8,r0 ; theta += waveph
  91. ADD r7,r7,#1 ; h++
  92. CMP r7,r2
  93. BLE as2
  94. MOV r0,r6
  95. LDMFD sp, {r5-r9,sp,pc}
  96. END