Homework 4
Library Database - an LC-3 Assembly Language Program

Due on Tuesday, December 7, 2010 at 5 pm


After successfully completing this assignment, you will be able to...

Before Starting

Read Chapters 6 and 7.

Description of Problem

The library at a small college keeps a database of information about students who currently have library materials out on loan. In this project you'll write an assembly language program to process this database. Your program will prompt the user for the ID number of a student, and will print the information that's stored in the database for that student.

Input and Output

The format of each record in the database is as follows: the first item is a student id, stored as an integer (max 3 decimal digits); the second item is the student's name (max 20 characters), stored as a zero-terminated ASCII string (one character per word); the third item is the number of library items currently charged to the student (an integer smaller than 10), and the fourth and fifth items represent the due date for the items (month and day, each stored as an integer). You may assume that all student items are due on the same date, and that all dates are in 2010. The database can contain any number of such records, and the last record in the database will be followed by a memory location containing the value x0000. The database starts at location x4000.

Given this database:
x4000         #123
x4001         'H'
x4002         'a'
x4003         'm'
x4004         'e'
x4005         'l'
x4006         x0000
x4007         #3
x4008         #4
x4009         #15
x400A         #3
x400B         'J'
x400C         'o'
x400D         'n'
x400E         'e'
x400F         's'
x4010         x0000
x4011         #1
x4012         #4
x4013         #23
x4014         #510
x4015         'S"
x4016         'm'
x4017         'i'
x4018         't'
x4019         'h'
x401A         x0000
x401B         #2
x401C         #5
x401D         #1
x401E         x0000

Your program interaction should look like this (depending on the user input):
Enter Student ID:  510

Name:  Smith
Number of items on loan:  2
Due date:  May 1, 2010
Enter Student ID:  443

Unknown ID
The format of your output should look just like the given examples.


This program is more complicated than it might first appear - don't wait until the last minute. Break the program into manageable parts instead of trying to write the whole thing at once. Here is one way you might want to approach this assignment:

There are other ways to break up the assignment; the point is to concentrate on one subtask at a time, test it completely, then move on to the next. Comment as you code!


Design Considerations

Make use of subroutines where appropriate. For example, your routines to convert an integer to an ASCII string, to convert an ASCII string to an integer, and to strip off leading zero's, should all be coded as subroutines.

Documentation Guidelines

You will be using the LC3Edit program to create your assembly language source file. Follow these formatting and documentation guidelines:


You should turn in two files for this assignment. hw4.asm contains the assembly language code for your program. database.asm contains sample data you used to test your program (use data different from the sample data given above). You must use web-based turnin to submit your LC-3 source files.