UMBC CMSC 313, Computer Organization & Assembly Language, Fall 2004

Project 4: An Error-Correcting Code, Part 2

Also available in PDF: project4.pdf.


Due: Thursday October 21, 2004


Objective

The objective of this programming exercise is to practice writing assembly language programs that use the C function call conventions.


Assignment

Modify your assembly language program from Project 3 so that it can be called from a C program as a C function with the following function prototype: char *encode(char *A, int n, int *mptr) ;

Here A is a pointer to a sequence of bytes in memory that should be encoded into the Hamming Code format from Project 3. The parameter n is the number of bytes in A. The result of the codewords must be stored in a memory location that is dynamically allocated. Your assembly language program must call malloc() to obtain a block of memory of the correct size. The address of this block of memory is the return value from encode(). The size of the block must be stored in the location specified by mptr.

Your program must work with the C main program p4main.c which is available in the following directory in the GL file system:

/afs/umbc.edu/users/c/h/chang/pub/cs313

This C program reads bytes from stdin and stores them in a dynamically allocated memory location. It then calls your encode() function and writes the resulting codewords to stdout. Thus, if your assembly language implementation of encode() works correctly, the program resulting from compiling it with p4main.c behaves exactly like the encoding program in Project 3.

If you cannot convert your assembly language program from Project 3 (e.g., if your program for Project 3 does not work), then you must implement a similar encode() function that copies the bytes in A, but inserts the byte 0xFFafter every three bytes. It must also pad the resulting memory block with 0xFF so the total length is divisible by 4. Implementing this version of the project will incur a 10% penalty.


Implementation Notes


Turning in your program

Use the UNIX submit command on the GL system to turn in your project. You should submit two files: 1) the assembly language program and 2) the typescript file of sample runs of your program. The class name for submit is cs313_0101. The name of the assignment name is proj4. The UNIX command to do this should look something like:

submit cs313_0101 proj4 p4encode.asm typescript


Last Modified: 22 Jul 2024 11:29:40 EDT by Richard Chang
to Fall 2004 CMSC 313 Section Homepage