Computer Technology and Society

Assignment 4

In this assignment you are to write a program in the simple machine language from the textbook.
  1. Your first program should copy part of the memory over to another place. It should define three data areas using "db". One of them is called "fra" and should contain the string "Žennan streng į aš afrita". The second area is called "til" and has space for the string. Then there is data area called "len" that contains the number of bites (i.e. letters) that should be copied.

    The program should read all the letters in the area "fra" and place them one after the other in the right place in the data area "til". It should though only copy as many letters as the contents of "len" indicates. To get you started here is a frame for a solution to the assignment.

  2. The second program should look for the largest value in a certain memory area. Here you also define three data areas. The first one, called "gogn" is the area where you look for the largest value. The second is called "len" and defines the length of the area "gogn". The third one is called "max" and should contain the largest value at the end of execution.

    The algorithm you can use is:

    To get you started here is a frame for a solution to the assignment.

Hand in these programs with a screenshots of Simpsim at the end of a run before noon on tuesday September 26th.

Extra assignment:
For those that want a more interesting project you should work on the following:
Write a program that copies itself to a new location in memory. Can you run the program in the new place? If not, what is the problem? Describe the problem and an idea for a solution. You do not have to actually write up the solution.
hh (hja), September 19th, 2006.