Question: The small program described here is known as a program loader, or , under certain circumstances as a bootstrap. This program takes advantage that instructions

The small program described here is known as a program loader, or, under certain circumstances as a bootstrap. This
program takes advantage that instructions and data are indistinguishable. Thus, instructions could be treated as if they
were data, if necessary.
Mailbox Mnemonic Opcode Comment
86 LDA 98598// initialize the STORE instruction at loc. 92
87 STO 92392// storing the contents of mailbox 98, that is 301
88 INP 901// input a value
89 SUB 97297// subtract 999
90 BRZ 01701// done loading--jump to 01 for execution
91 ADD 97197// restore input value
92 DAT 00// store value. This will contain 3XX, with XX indexed
93 LDA 92592// load the STORE instruction in 92
94 ADD 99199// increment it
95 STO 92392// and resave it
96 BRA 88688// continue with the next input
97 DAT 999999// value 999 for testing
98 DAT 301301// initial STORE 01 instruction as a data value
99 DAT 011// value 1 for indexing
II.- What you need to do
1. Load the above program loader in the LMC to understand what the program is doing. The instructions
should be loaded in your LMC at the mailboxes indicated above to work properly. Ensure that in mailbox 00
you have the instruction to branch to mailbox 86(first instruction of the program loader).
2. Run the program loader and input the instructions of the following user program:
// Input three numbers, output the sum of the first two, and output the third minus the first
00 INP
01 STA 09
02 INP
03 ADD 09
04 OUT
05 INP
06 SUB 09
07 OUT
08 HLT
09 DAT 00
Hint: Replace the mnemonics with the opcodes to input the instructions of this user program as numbers.
3. Move the program loader so that it starts at mailbox 00 in the LMC. Modify as required so it works
properly.
a. You need to take in consideration the relative positioning of the mailboxes and branches and modify
as required so it works properly
b. The original program loader loads the user program starting at mailbox 01, you need to change this
to load the user program starting at mailbox 30.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!