flat assembler
Message board for the users of flat assembler.

Index > DOS > Error in wav player

Author
Thread Post new topic Reply to topic
prostyle4444



Joined: 28 Jun 2013
Posts: 25
Location: Bootsector
prostyle4444 04 May 2014, 16:09
I tried to create a simple 8-bit 8000hz wav player in fasm but it is not working Embarassed . can anyone please point out the mistakes and correct it. Any help will be appreciated.

Code:
use16
org 100h

mov si, sound+44

start:
lodsb
mov byte [freq], al
mov al, 0
mov ax, [freq]
call speaker_on
call timer
call speaker_off
mov ax, 0
jmp start




speaker_on:
mov cx, ax                      
mov al, 182
out 43h, al
mov ax, cx                      
out 42h, al
mov al, ah
out 42h, al

in al, 61h                      
or al, 03h
out 61h, al
ret

speaker_off:    
in al, 61h
and al, 0FCh
out 61h, al
ret

timer:
mov cx, 125
mov dx, 0
mov ah, 86h
int 15h
ret

freq db 0

sound:
file 'test.wav'
    


Last edited by prostyle4444 on 05 May 2014, 10:31; edited 1 time in total
Post 04 May 2014, 16:09
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20302
Location: In your JS exploiting you and your system
revolution 04 May 2014, 22:59
What do you mean by not working? Crashes? No sound? Displays unicorns instead? Which OS are you using?
Post 04 May 2014, 22:59
View user's profile Send private message Visit poster's website Reply with quote
sid123



Joined: 30 Jul 2013
Posts: 339
Location: Asia, Singapore
sid123 05 May 2014, 00:14
Code:
mov ax, [freq] 
mov al, 0 
mov ah, 0 
    

Wow...........

_________________
"Those who can make you believe in absurdities can make you commit atrocities" -- Voltaire https://github.com/Benderx2/R3X
XD
Post 05 May 2014, 00:14
View user's profile Send private message Reply with quote
freecrac



Joined: 19 Oct 2011
Posts: 117
Location: Germany Hamburg
freecrac 05 May 2014, 05:16
mov ax, [freq] ; load AL with the value in DS:freq + load AH with the value in DS:sound

freq db 0

sound:
file 'test.wav'

mov si, sound+44 ; this location contains ?
Missing to load the wav-file.

Dirk
Post 05 May 2014, 05:16
View user's profile Send private message Send e-mail Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1900
DOS386 22 May 2014, 08:31
Code:
mov byte [freq], al ; Why ???
mov al, 0
mov ax, [freq] ; ERROR - operand size mismatch F**K F**K F**K
    


What the hell is ^^^ this supposed to do?

Here you can see working code: http://board.flatassembler.net/topic.php?p=158576#158576

If it doesn't work for you, then you either don't have DOS, or your PC does not have any speaker.
Post 22 May 2014, 08:31
View user's profile Send private message Reply with quote
prostyle4444



Joined: 28 Jun 2013
Posts: 25
Location: Bootsector
prostyle4444 24 Oct 2021, 09:28
Sorry, hadn't learnt about FFT back then. Would love to give it a try again when I can.
Post 24 Oct 2021, 09:28
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.