CS273: Introduction to Machine Organization and Programming

Spring 1998, Section 2

Lab 1: Introduction to Unix and the Simulator

This lab is meant to get you started and comfortable with the Unix computers that we will be using throughout the semester. You will also use the 68HC11 simulator for the first time.

The computers we will be using are standard PCs, running a version of Unix called Linux (usually pronouncing the 'li' like 'listen' and the 'nu' like 'nothing').

Using the terminal to start Netscape

Let's start Netscape. You do this by pointing to the terminal window, and entering

netscape&

and hitting <enter>. The ampersand tells the shell not to wait for this command to finish, but to continue to accept other commands right away.

Now that you have Netscape running, you can go to a Webpage with other parts of this lab.

http://www.cs.nmsu.edu/~jcook

What is Netscape?

Netscape is a browser for the World Wide Web. It lets you look at Web pages -- which are documents that have text and pictures on them. Documents have a name, called a URL, or Universal Resource Locator. This is what is in the Location field, so for the CS171 page, for example , the URL is

http://www.cs.nmsu.edu/~jcook/Classes/CS171

Documents can link to one another -- wherever you see underlined text, that text is a pointer to another document. You can go to the other document simply by clicking on the text (the mouse arrow shape changes to a little hand with a finger pointer). There are buttons near the top of Netscape that say back and forward -- these let you go back to your previous documents, or forward as well.

Learning about Unix

Now it's time to learn more about Unix. We will do this by browsing Web pages and doing some exercises. In the location box, click to bring up the prompt and change the URL to be

http://www.cs.nmsu.edu/~jcook

Near the bottom is a list of pages that are topics explaining Unix. For this lab, you must go through them one by one, in order, answering the questionsalong the way. You need to hand in your answers to these questions. You also need to hand in the answers to the questions in the section below.

Introduction to the Simulator

The assembler and 68HC11 simulator are in the following directory:

/home/faculty10/tano2/CS273/Public

The assembler is file as11 and the simulator is file Sim6811.

You can either create an alias for each one, or add the above directory to your path.

To create aliases, add the following to your .cshrc file:

To add the directory to your path, add the following to your .cshrc file:

set path = (. \ /home/faculty10/tano2/CS273/Public \ $path)

as11 and Sim6811 are object files, compiled for the PCs running Linux (so they won't work on another kind of computer)

Your source assembly language program must end with a .asm file extension. Suppose it is called `myprog.asm'

To assemble the file, and store the listing in a file, say `myprog.listing', do the following:

The object code is now stored in file `myprog.s19'. To simulate your program, enter:

Notice there is a help command. To exit the simulator, type control d.

Enter th eprogram below into a file, assemble it, run it, and answer thequestions below. Please give your answers to the TA.

Here is the program to enter.

       org $0
param1 fcb 5
param2 fcb 7
result rmb 2   
       org $f800 
start ldaa #5
      ldab param2   
      aba
      ldab param1  
      aba  
      staa result
end    jmp  end
      org  $fffe   
      fdb   start 
Questions:
  1. What is the final value stored in accumulator A?
  2. What is the final value stored in accumulator B?
  3. What address does ``result'' stand for?
  4. What is the final value stored in location result?