CS 270
|
You can use the following command to open the LC3:
~cs270/lc3tools/lc3sim-tk &Alternatively, for a command line version of the LC3:
~cs270/lc3tools/lc3simGiven an assembly code file (.asm file), you can assemble it using the following command:
~cs270/lc3tools/lc3as file.asmYour TA will show you how to add these to your path, so you can use the shortened versions of the commands to run the LC3.
A set of files have been prepared to help familiarize you with the structure of the LC3 and common uses for individual instructions. Copy these files into your own directory with the following command:
cp ~cs270/Current/recitations/R9/src/* .Investigate each of the files. The recitation also comes with a Makefile that will automatically assemble all .asm files in your directory. You can use 'make clean' to clear all .obj and .sym files when you are finished. The suggested order to view the files is a follows (you may check off files as you go): struct.asm
Now it's time to put what you learned to use. Create a file named mult.asm and copy this code
into it:
.ORIG x3000 IntMul ; Your code goes here ; Solution has ~9 instructions ; Don't use registers 5, 6, or 7 HALT ; Try changing the .BLKW 1 to .FILL xNNNN where N is a hexadecimal value or #NNNN ; where N is a decimal value, this can save you time by not having to set these ; values in the simulator every time you run your code. This is the only change ; you should make to this section. Param1 .BLKW 1 ; Space to specify first parameter Param2 .BLKW 1 ; Space to specify second parameter Result .BLKW 1 ; Space to store result .END