Getting Started

Part of the CS:2630 (22C:60) on-line collection, Fall 2014
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

If you do not currently have a College of Liberal Arts and Sciences Linux Account, you will need to set one up. This is done on-line using this web form:
-- https://mail.divms.uiowa.edu/clas_linux/
This can only be done on campus or through a VPN connection from off campus; see the second handout below for help with this issue.

You should first follow the quick-start guide to get access to the Liberal Arts Linux servers:
-- http://www.divms.uiowa.edu/clas_linux/help/qsguide.html
Before this, you will want to read up on accessing the Linux servers from the Internet:
-- http://www.divms.uiowa.edu/clas_linux/help/start/remote.html

From a Mac or a Linux machine, you will be able to use the lab machines directly using the ssh linux.cs.uiowa.edu command from a terminal window, and the scp command can be used for uploads and downloads. All of the tools used in this course run equally well under MacOS and Linux.

On a windows machine, you should probably use SecureCRT, available as a free download from https://helpdesk.its.uiowa.edu/software/signin.htm; SecureCRT includes an upload/download tool. You can also use PuTTY.

To run a program through the SMAL assembler, you will have to edit the file .cshrc in your home directory on the lab machines. The leading dot is part of the file name, and note, file names starting with dot are not listed when you list a directory with the ls shell command. Use the ls -a command to list all the files in your directory, including the hidden files.

You can use any text editor on these machines. Change the file so it looks like this:

# KEEP THESE TWO LINES FIRST !!
source /etc/CSHRC

... (there may be additional content here, don't change it)

# Add personal Customizations here.
alias smal ~dwjones/bin/smal32 -U ~dwjones/lib/hawk
alias link ~dwjones/bin/hawklink
alias hawk ~dwjones/bin/hawk
alias sparrowhawk ~dwjones/bin/sparrowhawk

The last 4 lines above, starting with the word alias are the lines you will need to add. After doing this, log out and back in again in order to activate the smal, link, hawk and sparrowhawk commands.

Now, if you have a SMAL source file, say a file named myfile.a, you can now assemble it with the shell command smal myfile.a. When you do this, the assembler will produce a listing file called myfile.l and an object file called myfile.o.

If there are no assembler errors, you can link the object file with the shell command link myfile.o. This will produce a Hawk executable called link.o. If there are no linker errors, you can run the executable with the command hawk link.o.

To print SMAL assembly listing files such as myfile.l in room 301 MLH, lp -o landscape myfile.l seems to work well. There are a myriad of ways to print files locally. In general, try for printing in a fixed font in landscape format.

Other Shells (Advanced Users)

Linux systems support several alternative shells (command line interpreters). The above instructions are written in terms of the default configuration on our departmental servers, where the default shell is tcsh and, on startup, this reads commands from the file .tcshrc, which, in turn reads from .cshrc where your changes go. If your .tcshrc has been customized so that it does not read .cshrc you may have to put the aliases in .tcshrc (at the very end).

You can check what shell you are running with the command echo $SHELL. On modern systems, the output will usually be either /bin/tcsh (meaning tcsh) or /bin/bash. In the latter case, you are using the bash shell, so you will need to put the aliases where bash wants them.

On startup, bash reads commands from .bashrc (there is a pattern here, the rc ending on the file name means "read commands"). The usual .bashrc file these days includes a line to check if there is a file named .bash_aliases. If that line is in your .bashrc, then your aliases go in the .bash_aliases file. Otherwise, they go at the end of the .bashrc file.

But note: The bash shell uses a different form of the alias command. If you are using bash, you will need to use the following alias commands:

alias smal='~dwjones/bin/smal32 -U ~dwjones/lib/hawk'
alias link='~dwjones/bin/hawklink'
alias hawk='~dwjones/bin/hawk'

These little incompatabilities between the different Unix/Linux shells are precisely why, once you get used to one shell, it is better to stick with it than to switch back and forth.