Sit at a computer that is one of the group of the computers that the lab instructor has designated. If the screen is blank, hit the <enter> key. Something should appear. If it doesn't tell the lab instructor and find another computer to use.
You should either see a login window in the middle of the screen, or a login prompt in text at the bottom of the screen. At the login: prompt, enter your username, and hit <enter>.
You should now have a password: prompt, (or if you have a login window, the cursor should be in the password field). Enter your password and hit <enter>. Note that nothing will appear on the screen while you are entering your password (or maybe *'s will appear for each letter you type).
If something goes wrong, you will see Login incorrect, and a new login prompt will appear (or in the window the window will just clear and wait for another username in the login window). Try again. If it fails again, contact a lab instructor.
When it works, if you logged in through a window, you will eventually see a GUI, a graphical user interface, like Windows or the Mac, but also different. You should have at least one window where a command prompt is waiting for you to type in commands. This window is called a terminal window, and the program controlling the prompt is called a shell.
If you logged in on a plain text screen at the bottom of the screen, you need to start the GUI. If you see a prompt that says ``Terminal type? [vt100]'', Just hit <enter>. If it just says ``Terminal type?'', type in ``vt100'' and then hit <enter>. Now you can start the GUI. You do this by typing in startx, and hitting <enter>. You should eventually see that same thing that the person who logged in through a window is seeing. On these machines, when you ``logout'' or exit the GUI, you are returned to the text-only screen, but you are not yet completely logged out. Don't forget to ``logout'' after quitting the GUI!!!! If you do not logout from the text screen, someone can come along and erase all your files, or do whatever they want with your account. You logout just by typing ``logout'' and hitting <enter>.
Now, 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 the Web pages for this class. In the box near the top of the Netscape window, with Location: in front of it, enter
http://www.cs.nmsu.edu/~hdp/cs273and hit <enter>. The home page for this class should appear.
http://www.cs.nmsu.edu/~hdp/cs273Documents 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.
http://www.cs.nmsu.edu/~jcook/Classes/This URL has pointers near the bottom of the page that is a list of pages that are topics explaining Unix. If Unix is new to you, you should go through all of the pages describing it. After the first couple of weeks, we will not consider questions about Unix to be high priority for spending lab time on.
To use the assembler and simulator programs, you have to add the directory where they are located to your search PATH, so that your command shell will find them. To do this, add the following line to your .cshrc file in your home directory, and put the line near the bottom of the file:
This will add the directory to your search path. To make this take effect, you can do one of several things: close your current terminal window and open a new one, log out and log back in, or do the command ``source .cshrc'' in your current window (you might also have to do ``rehash'').source /user/pfeiffer/gdl/cshrc.gdl
Once you have done the above, the commands ``as11'', ``sim11'' and ``tksim11'' should be available to you. The command named ``as11'' is the assembler, and ``sim11'' and ``tksim11'' are versions of the simulator. We are now ready to write and run some assembly programs.
First, using an editor of your own choice, type in the following program into a file named Lab1.asm. Store this file in your own directory structure (you might want to create a class subdirectory from your home, so that you are better organized).
org $f800 start ldab #$24 addb #$12 endlp bra endlp org $fffe fdb start
Now, assemble the program using the command `` as11 Lab1.asm
-l > Lab1.lst
''. This will assemble the program into machine
code, putting the machine code in a file called ``Lab1.s19'', and it
will produce a listing file called ``Lab1.lst''. After this step you
should have the files ``Lab1.asm'', ``Lab1.s19'' and ``Lab1.lst''. Look at
the listing file using the command ``more Lab1.lst
''. This
program is like the one we worked in the second class lecture. (Note:
in the command, the notation ``-l'' is ``dash-ell'', not ``dash-one''.)
Now run the program using the command ``sim11 Lab1.s19''. The simulator will print out a screen that looks like the following:
A 00 B 00 t=0 D 0000 X 0000 Y 0000 breakpoints -> SP 0000 PC F800 ldab #24 00 (.... ....) 0 1 2 3 4 5 6 7 8 9 a b c d e f 0000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ 0010 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ 0020 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ 0030 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ 0040 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ 0050 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ 0060 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ 0070 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ 0080 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ 0090 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ 00a0 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ 00b0 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ 00c0 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ 00d0 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ 00e0 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................ 00f0 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa ................What this shows is the status of the processor and its registers, and the RAM memory (the simulator puts the value ``aa'' in every byte of memory to start with). With the simulator, every time you hit <enter>, the simulator executes one machine instruction, and displays a new processor and memory status. In this way you can watch the registers and memory change values as the program is executed. The final instruction in the program just loops forever, so to quit the simulator, enter the command ``q'', or hit ``Ctrl-D''.
The ``t=<val>'' that is displayed on the first line (after registers A and B) is a count of the time that has elapsed during program execution (we will get to what this count means shortly). This counter is not a CPU register, it is just showing you how much time your program took to execute. This time count is displayed in integer notation.
Now run the program using the command ``tksim11
Lab1.s19
''. Note: to use this version of the simulator, you must
have assembled the program with the listing option. This
simulator version comes up in it's own window and shows what you saw
with sim11 on the left and the actual program listing file on the
right. Also instead of ``t=<val>'', there is a slot on the left to
count the number of ``Cycles'' the program has executed.
This sample progam just adds the value 24, and the value in memory location f803 (12) and places the result into accumulator B.
Thought Questions
1. What are the final values in the registers (in hex)?
2. What are the final values in memory locations $0000, $0001, and $0002 (in hex)?
3. What is the final time count when this program ends? (The program ends before the ``bra'' instruction (or ``endlp'' label) is executed. This instruction is just an infinite loop that halts the program. You should record the time count before this instruction executes even once. If you keep hitting <enter>, this instruction will just keep executing, and the time count will keep going up.)
For this lab, you do not have to hand anything in.