OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Mar 29, 2024 2:26 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: [SOLVED] PC speaker does not work
PostPosted: Mon Apr 02, 2018 9:33 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
Good day!
I tried to play sound from the PC speaker code:
BITS 16

Code:
start:
mov ax, 07C0h ; Set 4K stack space after this bootloader
add ax,, 288 ; (4096 + 512) / 16 apartments under paragraph
mov ss, ax
mov sp, 4096

mov ax, 07C0h ; Set data segment to where we're loaded
mov ds, ax

mov ax, 1000
call os_speaker_tone

jmp $

os_speaker_tone:
pusha

mov cx, ax ; Store note value now

mov al, 182
out 43h, al
mov ax, cx ; Set the frequency
out 42h, al
mov al, ah
out 42h, al

in al, 61 h ; Switch PC speaker
or al, 03h
of the 61 h, al

popa
ret

(This is a function of MikeOS.) But the sound does not work. When I run MikeOS, so sound worked. Please what do I do?

_________________
https://github.com/VendelinSlezak/BleskOS


Last edited by Klakap on Sat Apr 14, 2018 8:24 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: PC speaker does not work
PostPosted: Mon Apr 02, 2018 10:35 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
Silly question, but - does your computer actually have a speaker (connected)?


Top
 Profile  
 
 Post subject: Re: PC speaker does not work
PostPosted: Tue Apr 03, 2018 9:50 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
As far as I know, in the MikeOS PC speaker does not connect and the sound works. But when I copied the method from MikeOS that plays sound(os_speaker_tone) so after call his, I didn't get result!

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: PC speaker does not work
PostPosted: Tue Apr 03, 2018 10:12 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
You didn't answer my silly question.

Never mind.


Top
 Profile  
 
 Post subject: Re: PC speaker does not work
PostPosted: Tue Apr 03, 2018 10:21 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
MikeOS and my OS I run through qemu. I don't know whether it is in qemu a Pc speaker connected or not.

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
 Post subject: Re: PC speaker does not work
PostPosted: Sat Apr 14, 2018 8:23 am 
Offline
Member
Member

Joined: Sat Mar 10, 2018 10:16 am
Posts: 296
I already found the problem, it was sufficient to run the kernel:
Quote:
qemu-system-i386 -soundhw pcspk -kernel kernel

PC speaker works!

_________________
https://github.com/VendelinSlezak/BleskOS


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: DotBot [Bot], Majestic-12 [Bot] and 167 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group