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:
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.
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: