Homework 2

Due Monday, Oct. 22

Note: In this and future assignments, do not use any language construct (e.g. machine instruction types) not covered in our course by the due date.

Here you will do further work with the compression technique (run-length encoding) in Homework 1.

This time we will assume that the uncompressed array is one-dimensional, but still consists of 1s and 0s. We will again assume that the array has at least one nonzero element.

You may have heard the terms getters and setters, which are class methods to read and write to array elements. Say you have an array x as a member variable of some object o. Then instead of simply reading element 5 directly as the expression o.x[5], you would read it via a method call o.xgetter(5). The motivation is that this serves the encapsulation aspect of object-oriented programming philosophy.

Personally (note that these things are a matter of taste, and sometimes of hot debate), I consider the getter/setter concept to be a silly redundancy that overly complicates one's code. However in our case here of compressed arrays, it does make sense. So, in this assignment, you'll be writing Intel Linux assembly code for getter and setter subroutines for our RLE application.

Storage:

readsa():

writea():

Notes: