DUE DATE: Friday, December 6, 2002, at 5:00 PM
(no late submissions accepted!)
Summary
This project introduces students to I/O programming under Linux,
direct hardware programming, and some of the hardware devices inside the PC.
(Namely the speaker and the timer.)
Your task is to write a program that will play songs on the PC
speaker. 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-11-21