|
-
November 14th, 2003, 12:45 PM
#1
Senior Member
Beep a sound
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"
-
November 14th, 2003, 12:50 PM
#2
Senior Member
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
Creating further mindless stupidity....through mindless automation.
-
November 14th, 2003, 02:12 PM
#3
are u in win, lin or DOS??
guru@linux:~> who I grep -i blonde I talk; cd ~; wine; talk; touch; unzip; touch; strip; gasp; finger; mount; fsck; more; yes; gasp; umount; make clean; sleep;
-
November 14th, 2003, 11:52 PM
#4
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.
Code:
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
Be sure to include a final carriage return at the end of the file
then assemble it with DEBUG
Code:
C:\junk\html>debug<beep.txt
You will see this screen output.
Code:
=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
and BEEP.COM will be assembled. You can then execute it from the command line
or from windows by double clicking.
Code:
C:\junk\html>beep
C:\junk\html>
You should hear the beep, or default bell sound
EDIT!
I found it! In C it is.
duh!
I came in to the world with nothing. I still have most of it.
-
November 17th, 2003, 03:05 PM
#5
Senior Member
10x ... i tried and it works ... but only with debug ... it raised the same error when i use it in c++
-
November 17th, 2003, 04:06 PM
#6
Senior Member
Exuse me ... i mean in borland c++ builder and i can't use printf there 'cause i build visual program not console
-
November 18th, 2003, 12:17 AM
#7
Code:
// 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();
}
It is the
cout << "\a";
statement that works in C++
http://www.visualcomponentlibrary.com/cpp/Lesson01.htm
:cool:
I came in to the world with nothing. I still have most of it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|