Next: About this document
CSc 343
Computer Organization and Programming
Spring Quarter 1998
Programming Assignment #2 (Due: 13 May 1998, Wednesday)
Assignment Objectives:
To gain experience with
program control (procedures and jump instructions), screen
processing in text mode, and simple keyboard processing.
Problem Description:
Write an assembler program that will
simulate two clocks (one for ATLANTA time and
the other for another world city time) on the screen.
When your program begins, the screen should be cleared, the
following should be displayed, and the two clocks should keep advancing
(at the rate of approximately 1 second per second).
The clocks should have the following functionality:
- Daylight Savings Time: When the user presses the d
key, the ATLANTA TIME should toggle between EST
(Eastern Standard Time) and DST
(Daylight Savings Time).
When the time is switched to DST, the ATLANTA time
should be turned back 1 hour and the term DST should
replace EST. Similarly, when the time
is switched back to EST, the ATLANTA time should be
turned forward by 1 hour and the term EST should
replace DST.
- World City Times: Your program should have the
capability to display the times for the following cities.
CITY Difference with EST Difference with DST
-----------------------------------------------------
Karachi +9.00 +9.00
London +4.30 +5.30
Madras +9.30 +10.30
Paris +5.30 +5.30
Phoenix -2.00 -2.00
Singapore +13.00 +14.00
Wichita -1.00 -1.00
----------------------------------------------------
When the first letter of any of these cities is
pressed on the keyboard, the second clock should switch
to the time in that city and the clock should be appropriately
labeled with the name of the city. - Set Time: When the user presses the t
key, the user may set the ATLANTA time.
The user should be allowed to use the up arrow and
the down arrow keys to increase or decrease the hours
or minutes
setting of the time. The user should be able to switch between
setting hours and minutes by pressing the h or the m
keys. To begin with, you may assume that the hour will be set
with the arrow keys. Once the user is satisfied with the
time setting, the t key may once again be pressed to
return to the time display.
Note that when the ATLANTA time is set, the times in the
other cities are also changed appropriately.
- Reset Time: When the user presses the r
key, the ATLANTA time should be reset to AM 12:00
and the clock should start ticking immediately after the
reset. Note that the other city times should also be reset
under this option.
- Exit Program: The program should terminate when
the escape key is pressed at any time except while setting the
time.
Submission Instructions: Electronically submit clock.asm
and clock.exe by the deadline and submit program listing of
clock.asm.
Hints:
- Start small. For example, you might first write a program
that simply clears the screen and draws the box. Then, add the
time to the box. Make the clock tick next. Then, start adding
the functionality one at a time.
- You will need to make the cursor disappear (to avoid an
annoying flicker). Use INT 10H, function 03H, to determine the
top and bottom scan lines of the cursor. Save these in the
data segment. Then use INT 10H, function 01H, to make the cursor
invisible. Just before the program terminates, use the same
interrupt to restore the cursor to its original size.
- Some new DOS/BIOS services to use in this assignment (you will
need some of the services used in Assignment 1 as well):
INT 10H, Function 01H: Set Cursor Size
Useful for changing the size of the cursor or making it disappear
entirely. See Page 162 of the text for details. To make the
cursor disappear, put 20H in CH before performing the interrupt.
INT 16H, Function 11H: Determine if key pressed
Useful to check if the user has pressed any key. See P 191 for details.
INT 16H, Function 10H: Read key from keyboard
Useful after we have determined that the user has pressed a key.
- You will need to use the extended ASCII codes for the characters
that will make up the box containing the time (see Page 171 of text).
These are: CDH for Horizontal double line, BAH for Vertical double line,
C9H for Top Left, C8H for Bottom Left, BBH for Top Right and
BCH for Bottom Right.
- Be careful not to display 12:00:00 as 00:00:00.
- Be careful about midnight and noon transitions.
Next: About this document
Raj Sunderraman
Sun May 3 14:19:23 EDT 1998