SHARE
TWEET

Untitled

a guest Jan 20th, 2020 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;podzielniki czestotliwosci
  2. TC equ 36156;36060; 1193180Hz/33Hz
  3. TD equ 32248;32162; 1193180Hz/37Hz
  4. TE equ 29101;29024; 1193180Hz/41Hz
  5. TF equ 27117;27045; 1193180Hz/44Hz
  6. TG equ 24350;24285; 1193180Hz/49Hz
  7. TA equ 21694;21636; 1193180Hz/55Hz
  8. TH equ 19244;19193; 1193180Hz/62Hz
  9. TP equ 1;pauza
  10. ;Q koniec melodii
  11. Progr segment
  12. assume cs:Progr,ss:stosik,ds:dane;
  13.  
  14. ;Procedury
  15. linijka proc
  16. mov ah,09h
  17. int 21h
  18. ret
  19. endp
  20.  
  21. readln proc
  22. mov ah,0ah
  23. int 21h
  24. ret
  25. endp
  26.  
  27. no_file proc
  28. mov dx,offset napis1
  29. call linijka
  30. jmp exit
  31. endp
  32.  
  33. close_file proc
  34. mov ah,3Eh
  35. mov bx,fileHandle
  36. int 21h
  37. ret
  38. endp
  39.  
  40. open_file proc  
  41. mov dx,offset plik
  42. mov ah,3dh
  43. mov al,0
  44. int 21h
  45. jc no_file
  46. mov fileHandle,ax
  47. ret
  48. endp
  49.  
  50. read_file proc
  51. push cx
  52. push dx;
  53. mov bx,fileHandle
  54. mov cx,3
  55. mov dx,offset bufor;
  56. mov ah,3Fh
  57. int 21h
  58. pop dx
  59. pop cx
  60. ret;
  61. endp;
  62.  
  63. nuta proc
  64. push dx;
  65. push cx;
  66. mov cx,16;
  67. mov ah,86h;
  68. int 15h
  69. pop cx
  70. pop dx
  71. ret
  72. nuta endp;
  73.  
  74. polnuta proc
  75. push dx;
  76. push cx;
  77. mov cx,8;
  78. mov ah,86h;
  79. int 15h
  80. pop cx
  81. pop dx
  82. ret
  83. polnuta endp;
  84.  
  85. cwiercnuta proc
  86. push dx;
  87. push cx;
  88. mov cx,1;
  89. mov ah,86h;
  90. int 15h
  91. pop cx
  92. pop dx
  93. ret
  94. cwiercnuta endp;
  95.  
  96. szest proc
  97. push dx
  98. push cx
  99. mov cx,0
  100. mov dx , 65535
  101. mov ah,86h;
  102. int 15h
  103. pop cx
  104. pop dx
  105. ret
  106. szest endp;
  107.  
  108. speakerON proc
  109.  
  110. mov ax,ton
  111. out 42h,al
  112. mov al,ah
  113. out 42h,al
  114.  
  115. in al,61h;
  116. or al,00000011b;
  117. out 61h,al;
  118. ret
  119. endp
  120.  
  121. speakerOFF proc
  122. in al,61h;
  123. and al,11111100b;
  124. out 61h,al;
  125. ret
  126. endp;
  127.  
  128. play proc
  129. call speakerON
  130. cmp czas,1
  131. je cala
  132. cmp czas,2
  133. je pol
  134. cmp czas,4
  135. je cwierc
  136. cmp czas,6
  137. je eight
  138. jmp endplay
  139.  
  140. cala: call nuta
  141. jmp endplay
  142. pol: call polnuta
  143. jmp endplay
  144. cwierc: call cwiercnuta
  145. jmp endplay
  146. eight: call szest
  147. jmp endplay
  148. endplay:
  149. call speakerOFF
  150. ret
  151. endp
  152.  
  153.  
  154. ret
  155. endp
  156. ;--------------------------------------------------------------------
  157. start: mov ax,dane
  158. mov ds,ax
  159. mov ax,stosik
  160. mov ss,ax
  161. mov sp,offset szczyt
  162.  
  163.  
  164. mov ah, 62h    
  165. int 21h        
  166. mov es,bx
  167. mov al,es:[0080h]
  168. mov cl,al
  169. sub cl,2  
  170. mov si,0
  171. cmp al,0
  172. jbe brak
  173. przep:
  174.  
  175. mov al,es:[0081h+si+1]                          
  176. mov bx,offset plik        
  177. mov ds:[bx+si],al
  178. cmp cl,0
  179. je end_przep        
  180. dec cl            
  181. inc si
  182. jmp przep
  183.  
  184. end_przep:
  185.  
  186. mov dx,offset napis3
  187. call linijka
  188. call open_file
  189.  
  190. melodia:
  191. call read_file
  192. mov dl,bufor(0)
  193. cmp dl,'Q'
  194. je exit1
  195.  
  196. cmp dl,'C'
  197. je do
  198. cmp dl,'D'
  199. je re
  200. cmp dl,'E'
  201. je mi
  202. cmp dl,'F'
  203. je fa
  204. cmp dl,'G'
  205. je so
  206. cmp dl,'A'
  207. je la
  208. cmp dl,'H'
  209. je Zi
  210. cmp dl,'P'
  211. je pauza
  212.  
  213.  
  214. graj:
  215. mov cl,bufor(1);oktawa
  216. sub cl,31h
  217.  
  218. shr ton,cl;
  219. graj1:
  220. mov cl,bufor(2);czas
  221. sub cl,30h
  222. mov czas,cl
  223.  
  224. call play;
  225.  
  226. mov ah,0Bh
  227. int 21h
  228. cmp al,0
  229. jne exit
  230. jmp melodia;
  231.  
  232. brak:
  233. call no_file
  234. jmp exit
  235.  
  236. exit1:
  237. jmp exit
  238.  
  239. do: mov ton,TC
  240. jmp graj
  241. re: mov ton,TD
  242. jmp graj
  243. mi: mov ton,TE
  244. jmp graj
  245. fa: mov ton,TF
  246. jmp graj
  247. so: mov ton,TG
  248. jmp graj
  249. la: mov ton,TA
  250. jmp graj
  251. zi: mov ton,TH
  252. jmp graj
  253. pauza: mov ton,TP
  254. jmp graj1
  255.  
  256. exit:
  257. call close_file
  258. call linijka
  259. mov ah,4ch
  260. mov al,00h
  261. int 21h;
  262.  
  263. Progr ends;
  264.  
  265.  
  266. dane segment
  267.        
  268. ton dw 0
  269. czas db 0
  270.  
  271.  
  272. plik db 0,0,0,0,0,0,0,0,0,0,0,0
  273.  
  274. fileHandle dw 0
  275. bufor db 3 dup(0)
  276. napis3 db 'Muzyka',10,13,'$'
  277. napis1 db 10,13,' Plik nie istnieje !!!$';
  278. dane ends
  279.  
  280.  
  281. stosik segment
  282. dw 100h dup(0)
  283. szczyt label word
  284. stosik ends
  285. end start
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top