Hi all,
I need help with generating sound in c++ or asm. But the sound not from the speakers, but from the motherbother. I tried
mov ax, 0x0e07
xor bx, bx
int 0x10
But when i compile raised an error "Access violation"
Printable View
Hi all,
I need help with generating sound in c++ or asm. But the sound not from the speakers, but from the motherbother. I tried
mov ax, 0x0e07
xor bx, bx
int 0x10
But when i compile raised an error "Access violation"
This would all depend upon the motherboard, and chipset...
What type is it? AMD? Intel?...that all makes a difference, as they all have different access restrictions.
Post some specs, and I'll try to help you out...I'm not great with ASM, but I'm a dabbler :)
are u in win, lin or DOS??
It probably only works in DOS, or a DOS window, because the int 10h is
a BIOS service, not available to a protected mode program.
I know it won't work in linux, because I've tried, but probably won't in windows
either. Do it like this
write a source file like this.
Be sure to include a final carriage return at the end of the fileCode:N BEEP.COM
A 100
MOV AX,0E07 ;Write character 07h TTY mode
INT 10 ;BIOS video services
INT 20 ;Terminate program (and return to DOS)
RCX
7
W
Q
then assemble it with DEBUG
You will see this screen output.Code:C:\junk\html>debug<beep.txt
and BEEP.COM will be assembled. You can then execute it from the command lineCode:=N BEEP.COM
=A 100
11CF:0100 MOV AX,0E07 ;Write character 07h TTY mode
11CF:0103 INT 10 ;BIOS video services
11CF:0105 INT 20 ;Terminate program (and return to DOS)
11CF:0107
=RCX
CX 0000 :7
=W
Writing 0007 bytes.
=Q
or from windows by double clicking.
You should hear the beep, or default bell soundCode:C:\junk\html>beep
C:\junk\html>
EDIT!
I found it! In C it is.
duh!Code:printf("\a");
:cool:
10x ... i tried and it works ... but only with debug ... it raised the same error when i use it in c++
Exuse me ... i mean in borland c++ builder and i can't use printf there 'cause i build visual program not console
It is theCode:// Introductory lesson to C++
#include <iostream.h>
/* This is the main function.
It is included on every C++ program.
It is the central point of a C++ application.*/
main()
{
cout << '\t' << "- Borland C++ Builder -\a" << endl;
cout << "This will end our session today" << "\n";
cout << "\n\nPress any key to continue...";
getchar();
}
cout << "\a";
statement that works in C++
http://www.visualcomponentlibrary.com/cpp/Lesson01.htm
:cool: