SHARE
TWEET

Untitled

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