Voc_asm.asm 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. include_macros equ 1
  2. include_deb_mac equ 1
  3. include_flags equ 1
  4. include_struc equ 1
  5. include include.asm
  6. start32data
  7. ; Header as I thought it was
  8. ;head_data db "Creative Voice File",1ah
  9. ; dw 1ah
  10. ; dw 10ah
  11. ; dw 1129h
  12. ; Header for sound driver
  13. head_size equ 22
  14. head_data db 20 dup (?)
  15. dw head_size ;pointer to start of data
  16. align 4
  17. voc_progress dd 0
  18. end32data
  19. start32code
  20. proc_start _play_voc_data__Npcii
  21. pvd_data equ 16
  22. pvd_size equ 12
  23. pvd_chan equ 8
  24. ; make the header
  25. push es
  26. push ds
  27. pop es
  28. mov esi,offset head_data
  29. mov edi,pvd_chan[ebp]
  30. mov edi,[offset voc_work_space + edi*4]
  31. mov ecx,head_size
  32. rep movsb
  33. mov eax,pvd_size[ebp] ;make up header and size
  34. inc eax
  35. inc eax
  36. shl eax,8
  37. mov al,1
  38. stosd
  39. mov ax,0aah
  40. stosw
  41. mov esi,pvd_data[ebp]
  42. mov ecx,pvd_size[ebp]
  43. rep movsb
  44. mov ax,504h
  45. mov cx,7fh
  46. mov ah,101
  47. add ah,pvd_chan[ebp]
  48. add ah,pvd_chan[ebp]
  49. clear ch
  50. ; Wait until a timer interrupt has occured to prevent any conflicts which may or may not happen
  51. ifndef no_timer
  52. btr [system_flags],sf_timer_tick
  53. pv_wait: btr [system_flags],sf_timer_tick
  54. jnc pv_wait
  55. endif
  56. call music_command
  57. pop es
  58. ifdef with_voc_editor
  59. mov eax,[voc_work_space]
  60. endif
  61. proc_end _play_voc_data__Npcii,12
  62. voc_progress_report2 proc
  63. ; check if a voc file is playing and if it has finished
  64. ; al holds channel no to check
  65. bt [system_flags],sf_voc_playing
  66. jnc not_playing
  67. push eax
  68. mov ah,0ch
  69. ;mov ax,0cffh
  70. call music_command
  71. ifdef debug_42
  72. mov eax,[music_command_return_value]
  73. mov [voc_progress],eax
  74. endif
  75. pop ebx
  76. mov eax,[music_command_return_value] ;try it twice, save first one
  77. push eax
  78. mov al,bl
  79. mov ah,0ch
  80. ;mov ax,0cffh
  81. call music_command
  82. pop eax
  83. jifne eax,still_playing
  84. test [music_command_return_value],-1 ;0 when it is all over
  85. jne still_playing
  86. btr [system_flags],sf_voc_playing
  87. ifdef with_replay
  88. mov eax,-4
  89. call replay_record_event
  90. endif
  91. still_playing:
  92. not_playing: ret
  93. voc_progress_report2 endp
  94. end32code
  95. ;--------------------------------------------------------------------------------------------------
  96. ;--------------------------------------------------------------------------------------------------
  97. ;--------------------------------------------------------------------------------------------------
  98. ;--------------------------------------------------------------------------------------------------
  99. ifdef with_voc_editor
  100. max_no_lines equ 10
  101. start32data
  102. text_data dd max_no_lines dup (0)
  103. ;voc_data_end dd 0 ;used to clear ends of old messages
  104. end32data
  105. start32code
  106. public _redisplay_line__Nipc
  107. proc_start _redisplay_line__Nipc
  108. rl_line equ 12
  109. rl_data equ 8
  110. mov edi,rl_line[ebp]
  111. not_there: mov dl,-1
  112. mov cx,255
  113. mov ebx,[offset text_data + edi*4]
  114. mov esi,rl_data[ebp]
  115. push ebp
  116. push edi
  117. clear ebp
  118. call display_text
  119. pop edi
  120. mov [offset text_data + edi*4],eax
  121. pop ebp
  122. proc_end _redisplay_line__Nipc,8
  123. proc_start _display_lines__Nv
  124. ; put the lines on to the screen
  125. mov ecx,max_no_lines
  126. mov esi,offset text_data
  127. push es
  128. mov es,[screen_segment]
  129. mov edi,20*full_screen_width+20
  130. line_loop: lodsd ;address of data
  131. jife eax,no_line
  132. push ecx
  133. push esi
  134. push edi
  135. movzx ebx,(s ptr[eax]).s_width
  136. movzx edx,(s ptr[eax]).s_height
  137. lea esi,SIZE s[eax]
  138. pix_loop: push edi
  139. mov ecx,ebx
  140. rep movsb
  141. pop edi
  142. lea edi,full_screen_width[edi]
  143. floop edx,pix_loop
  144. pop edi
  145. pop esi
  146. lea edi,(12*full_screen_width)[edi]
  147. pop ecx
  148. no_line: loop line_loop
  149. pop es
  150. proc_end _display_lines__Nv
  151. proc_start _bincpy__Npvpvi ;(char *to, char *from, int count)
  152. bcz_to equ 16
  153. bcz_from equ 12
  154. bcz_count equ 8
  155. mov esi,bcz_from[ebp]
  156. mov edi,bcz_to[ebp]
  157. mov ecx,bcz_count[ebp]
  158. cmp esi,edi ;check direction
  159. je moved
  160. jc upz
  161. ; move down in memory
  162. rep movsb
  163. jmp moved
  164. ; move up in memory so do opposite direction
  165. upz: add esi,ecx
  166. dec esi
  167. add edi,ecx
  168. dec edi
  169. std
  170. rep movsb
  171. cld
  172. moved:
  173. proc_end _bincpy__Npvpvi,12
  174. end32code
  175. endif
  176. end
  177.