Discussion:
Lab 2 - Batch
(too old to reply)
John Hayford
2005-11-07 02:25:35 UTC
Permalink
Is there anyway to have the isem read input from a file instead of
typing it all in?

John
William R. Lorenz
2005-11-07 04:53:44 UTC
Permalink
Hi John,
Post by John Hayford
Is there anyway to have the isem read input from a file instead of
typing it all in?
I put all the user input in an easily-accessible text file with each
value to be input to the program on a separate line. For example:

0x1a
1
0x19
1
0xe
-3
[...continued...]

With that in a text file, I loaded the executable in ISEM, set a
breakpoint after the user input had been stored in memory (so that I
could start to debug the program after all the values were loaded) and
then ran the program. The program prompted for the first value, and I
copied all the lines from the text file and just pasted them all at once
into the ISEM emulator. No need to worry about what the ISEM emulator
prints to the screen -- as long as it gets all the input, that works.
This provided me with an easy way to get all the input in there quickly.

Hope this helps. Let me know if you have any questions.
John Hayford
2005-11-07 07:51:29 UTC
Permalink
It does, and actually, you dont have to set for the breakpoint. Simply
copying and pasting will work, from "ru" to "-1".
John
Post by William R. Lorenz
Hi John,
Post by John Hayford
Is there anyway to have the isem read input from a file instead of
typing it all in?
I put all the user input in an easily-accessible text file with each
0x1a
1
0x19
1
0xe
-3
[...continued...]
With that in a text file, I loaded the executable in ISEM, set a
breakpoint after the user input had been stored in memory (so that I
could start to debug the program after all the values were loaded) and
then ran the program. The program prompted for the first value, and I
copied all the lines from the text file and just pasted them all at once
into the ISEM emulator. No need to worry about what the ISEM emulator
prints to the screen -- as long as it gets all the input, that works.
This provided me with an easy way to get all the input in there quickly.
Hope this helps. Let me know if you have any questions.
B A Bair
2005-11-07 15:35:02 UTC
Permalink
Another strategy that students have adopted in the past, is to preload all
the data and instructions into the MEM array (as in lab1) for testing
purposes.

You will also have to comment out 'loadMem', so you should do this only
after you have debugged that section.

Remember to restore 'loadMem', and removed all the preloaded data and
instructions before you submit!

:-)
Bettina
IV
2005-11-09 15:25:47 UTC
Permalink
I found it easier to put a ba before the loadMem section. I only had
to write something on one line, and I only had to remember to delete
from one line. It was also right at the top, so no searching required.
Wayne D. Heym
2005-11-07 17:02:34 UTC
Permalink
Hi Bill,

This is a grand contribution to our bag of tricks for this course. I
had previously been unaware of this possibility. Being aware that
Isem's input routines, such as "ta 5", don't respond at all to Unix's
redirection of standard input to come from a file, I had despaired of an
automatic solution other than changing the .data section. I'm sure
graders for the course will be extremely interested to learn this news.
Brilliant! Thank you very much!
Post by William R. Lorenz
Hi John,
Post by John Hayford
Is there anyway to have the isem read input from a file instead of
typing it all in?
I put all the user input in an easily-accessible text file with each
0x1a
1
0x19
1
0xe
-3
[...continued...]
With that in a text file, I loaded the executable in ISEM, set a
breakpoint after the user input had been stored in memory (so that I
could start to debug the program after all the values were loaded) and
then ran the program. The program prompted for the first value, and I
copied all the lines from the text file and just pasted them all at
once into the ISEM emulator.
--
Wayne
Continue reading on narkive:
Loading...