We have to write a c++ program for Little man's computer in which
A text file containing machine code (not assembly code) for little man's computer following instruction set . Instructions are in different lines (no need for semicolon at the end of each instruction)
Arithmetic 1xx ADD
Data Movement 3xx STORE
BR 6xx JUMP
BRZ 7xx BRANC ON 0
BRP 8xx BRANCH ON +
Input/Output 901 INPUT
Machine Control 000 HALT
(coffee break) COB
Any output specified in the input file by 902 will be displayed on screen
· Two digits memory (mail box) address: 00-99
· Three digits instruction or data in each memory slot
· One calculator, one program counter
· The program in the input file needs to be loaded into memory first and stored in consecutive slots starting from address 00
· 901 instruction will ask user's input from keyboard, 902 displays content in calculator
Your program should accept any length of input program that can be fit in little man's 100 memory slots and generate correct result and/or output on screen.
Submit the source code together with readme file with instruction to compile, build and use your program.
Input file contains following code (return positive difference):
Running of the program with this input will ask user to input 2 numbers, let's say 5 and 10, the program will output the positive difference on the screen, which is 5.
Attached is the C++ code for Little Man's computer and inputData.txt which contains the test program. The inputData file must be in the same location as the program. The code can be implemented in many ways, so this ...
A C++ Program Simulating Little Man's Computer. Reads simple machine code from input file and interprets it to execute arithmetic commands.