DUE DATE: Friday, April 12, 2002, at NOON
(no late submissions accepted!)
Summary
This project continues with our trend of direct hardware
access, introducing students
to I/O programming under the Linux operating system. In particular, after
doing this project, students should be familiar with the
design and implementation of device drivers under Linux and file I/O
provided through Linux system calls.
Your task is to write a program that will play songs on the PC
speaker. (Oh no, not again!) Such a song will be stored in a
binary file, format of which is provided below. Your program should read
this song file and play the notes contained therein on the PC
speaker.
Tune file format
The data in the tune file is stored in binary format. The actual song can
be written in x86 assembly language, then assembled to produce a
binary file, known as compiled data file. The format of the file is as
follows:
- First 8 bytes of every tune file is the file signature. (ASCII
string PlayTune .)
- The next word (2 bytes) specifies the number of notes in the file.
- The next word (2 bytes) specifies the tempo value
of the song. You can think of this value as the speed at which the song is
played.
- After that, everything that follows is a list of notes
to play. Every item in the list is a doubleword (4 bytes), where the first
two bytes give the frequency of the note to play, and the second two bytes
give the duration of the note.
Notes
What to turn in
Turn in a printout of your code. Include instructions on running your program.
Place your source files in the submit directories for cs235, located under
/home/submit/cs235/<username>.
You may turn in your source files on a floppy, if you wish.
Alex Fedosov
2002-05-06