Week 4 Lab
Week 4 Lab
Objectives
Instead of accepting user input from the console (keyboard), the Wombat machine is able to
read inputs from and write outputs to a text file. This can be enabled by setting the following
options in the simulator:
Then choose File… for input and/or output from the drop-down list. The default is [Console].
You will need to identify the files from the Open Dialog box that appears next.
Question 1
Using the given input.txt file and a blank output.txt file, change the above settings in your
machine and run the sample program from Lab 1 (sample.txt) that reads and adds a set of
numbers from the input file and prints the sum to the output file.
Question 2
Write a machine language program which reads three integers from a text file and computes
the result for the following function:
Z=A+BxC
where A, B and C are the three integers read from the file (assume first value is A, second value
is B, and third value is C). After computation, display the result of the function (value Z) on the
IO Console.
Question 3
Write a machine language program that accepts integer inputs from the user (console input),
determines the largest value of the inputs entered and prints this largest value on the console.
The program should keep prompting for user input (accept both positive and negative integers)
until user enters -99 (this is the sentinel value, thus should not be used in computation).