flat assembler
Message board for the users of flat assembler.
Index
> Tutorials and Examples > DOS Sound Effects |
Author |
|
HaHaAnonymous 20 Apr 2013, 16:00
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:00; edited 1 time in total |
|||
20 Apr 2013, 16:00 |
|
DOS386 28 Apr 2013, 15:02
It works
PS: a version of this had been included with the CC386 compiler for centuries http://ladsoft.tripod.com/cc386.htm (dead) http://ladsoft.tripod.com/cc386_compiler.html Last edited by DOS386 on 02 Jun 2013, 08:02; edited 1 time in total |
|||
28 Apr 2013, 15:02 |
|
DOS386 02 Jun 2013, 08:01
Code: ; FONETONE.ASM (optimized and bug-free) 2013-Jun-02 format binary as "COM" org $0100 use16 call group12sub mov cx, $1E ; 30 call delaysub call group12sub mov ax, $4C00 int $21 ; F**K OFF ;--------- group12sub: mov dx, 12 ; 12 pulses of each tone @@: mov bx, 2000 ; Frequency of first tone call speakerondelsub mov bx, 1600 ; Frequency of second tone call speakerondelsub dec dx jnz short @b in al, $61 and al, 252 ; %1111'1100 out $61, al ; Speaker OFF ret ;---- speakerondelsub: mov al, 182 ; %1011'0110 | Channel 2 out $43, al xchg ax, bx ; Incoming freq in BX (trashed) out $42, al mov al, ah out $42, al in al, $61 or al, 3 ; %0000'0011 out $61, al ; Speaker ON mov cx, 1 ; and pass delaysub: xor ax, ax ; MOVNTQ AX, 0 mov es, ax ; MOVNTQ ES, 0 delay_loop: mov al, [es:$046C] ; BIOS timer @@: cmp al, [es:$046C] ; BIOS timer je short @b loop short delay_loop ; Incoming delay in CX (trashed) ret ; We trashed AX and CX and ES !!! ;---- FONETONE.COM 80 7F2B'EAAE'360A'7389'E512'E0E2'3242'1273 - Fixed critical BUG with risk of permanent hanging in the delay sub - Fixed BUG with junk delay on exit - Simplified code and reduced nested loops - Reduced bloat from 116 to 80 Byte's |
|||
02 Jun 2013, 08:01 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.