Letter | Frequency |
D | 256 Hz |
R | 287 Hz |
M | 322 Hz |
F | 341 Hz |
S | 383 Hz |
L | 430 Hz |
T | 483 Hz |
d | 512 Hz |
After reading all inputs, the program concurrently
Note: Since concurrency is a requirement in this assignment, you CANNOT
use delay loop to implement the duration. You must know how
to interrupt the system clock (lab assignment).
When hwk2 is run, it prints out "Input number of notes = ".
In this example, the user types "3" and press the [Enter] key.
Then, he types in 3 notes with their durations and frequencies
(in letter). After the last input, the music starts immediately,
and the system clock is kept updating.
C:\> hwk2
Explanation of output:
C:\> hwk2 < notes.txt
The same should be heard. You are not required to
disable the input prompt "Input number of notes = " if your hwk2
is played with a piece of music score.
Lab 08:
[Tasm and Tlink]
8086 architecture and "hello world" program, use of debugger
We purposely do not provide many program skeletons in a cut-and-paste
ready form. We encourage you to type in the program skeleton and your
modification yourself, using
an editor such as notepad. Then, assemble and link your .asm and
.obj files to produce an .exe file.
We shall put several reference books on 80x86 assembly language in the
Library (reserve section). Specifically, you should use turbo assembler
(TASM) and turbo linker (TLINK). The TAs will use TASM
and TLINK to assemble and link your program, respectively.
We shall also put a 25-page handout, a concise reference
manual for 80x86 assembly language, in the reserve section of
the Library. All the instructions there are more than sufficient
to implement this assignment. Four copies, one for each session,
will be reserved in Library, view it on-line here
Late submission is NOT allowed.
Sample run and requirement
In this assignment, assume all inputs are valid: the
user (or the grader) must input non-negative numbers for number of notes
to be played, and for their duration. Also, your program can
assume either 'D', 'R', 'M', 'F', 'S', 'L', 'T', or 'd'
is entered as note frequencies. Therefore, it saves you a lot
of checking. You need not make your program's input validation
procedure a bullet-proof one.
Input number of notes = 3
3
D
2
R
1
M
14:59:58
Alternatively, you can be a composer, by preparing the following
music score (do you like Henry Macinni, by the way?),
stored as a file (named "notes.txt", for instance):
3
3
D
2
R
1
M
Using the same program without modification, we can redirect
the keyboard input to file, without having the user type in all
the notes tediously every time the same piece of music is played:
14:59:58
Things to know for this homework
You should know the following before starting to code the program:
Prerequisites
Granted, you have to implement the following lab exercises.
Reading and understanding the labs without actual implementation equal to
nothing.
The lab exercises will guide you, step-by-step, to the end of successful
implementation of the PC Piano. All lab exercises are self-explanatory.
We publish them once and for all, for students who want to finish the
assignment quick:
Lab 09:
[program skeleton | full program]
"day2date" convertor
Lab 10:
[full program]
Generating sound using 8255 PPI and 8253 timer
Lab 11:
[full program]
System clock interrupt
Lab 12:
[solutions]
Addressing mode
References
Reference on 80x86 programming in the textbook is sparse.
Grading
Correctness: 70%
Documentation : 20%
Programming style (procedural or modular approach?): 10%
Submission
Your program will be collected automatically using our automatic collection system (ACS). For easy identification, your name, student number, e-mail address, department, lecture and lab sections should be written clearly as comments at the very beginning of your program. A well-documented program should be kept in a file named as ~yourlogin/comp180/hwk2/hwk2.asm on
the Computer Science Department Unix server by 5pm on May 11, 2001. If you want to include your music scores, be sure that the filenames have the
extension .txt. Please refer to the detailed instructions here if you are not familiar with using the ACS for homework submission. Contact your TA or instructor well before the due date if you encounter any problem.
Academic integrity
Cheating by copying from others, or providing your program to
others, are strictly forbidden. Check out the departmental
procedures for handling cheating.
Last update
Sun Mar 18 12:36:47 HKT 2001