The idea is to be able to use diff
on memory dumps to view and
grade the
students submission. To make this easier, all parameters and outputs are placed
at fixed addresses that are independent of the students code. To accomplish
this, the students are given a skeleton which looks like the following:
;File: --> fill this in
;Description: --> fill this in
;Author(s): --> fill this in
;Date: --> fill this in
; ********************** BEGIN RESERVED SECTION **********************
; You may initialize values here (i.e., change the value of a .FILL
; statement), but you may *not* add or remove instructions or perform
; any edit which changes the address of a label in this section
.ORIG x3000 ; DO NOT change any code before label END_DATA
BR BEGIN_CODE ; jump to beginning of code
BEGIN_DATA .FILL xABCD ; start of provided variables
PARAM1 .FILL xxx ; these are assignment specific
PARAM2 .FILL yyy
RESULT1 .BLKW 1
RESULT2 .BLKW 1
RESULT_ARRAY .BLKW 20
END_DATA .FILL xFECD ; end of provided variables
; ********************** END RESERVED SECTION **********************
;---------you may add more variables or code below this line --------
BEGIN_CODE ; your code begins here
The labels BEGIN_DATA
and END_DATA
allows the grading script to simply dump memory from BEGIN_DATA
and END_DATA
. This will then dump all relevant values. It also
has the benefit of (possibly) detecting overwrites in case a block of data
(an array) is part of the output.
Testing the assignment can be performed using the scripting capability of
lc3sim
. Specifically, a command file like the following is used:
file assigX.obj
memory PARAM1 testValue1
memory PARAM2 testValue2
continue
list BEGIN_DATA END_DATA
quit
This set of commands
assignX.obj
PARAM1
and PARAM2
)
lc3sim
, simply start
the simulator (lc3sim
NOT lc3sim-tk) and
type help
.
Because the addresses are predefined by the provided code, the list shows
the same addesss for every students code. Only the values will change.
Thus, diff
will correctly detect differences.
To execute lc3sim
with a script file use the syntax
lc3sim -s scriptFile
.
When you want to do character input in a simulator run (i.e. use the LC3
IN
instruction), I have found that
a executing lc3sim -s scriptFile < fileOfInput
works.
Fritz Sieker - Jan 2012