Question
Please answer this problem in JAVA. Special Section: Building Your Own Computer 323 Machine-Language Programming) Let's create a computer called the Simpletron. As its lies,
Please answer this problem in JAVA.
Special Section: Building Your Own Computer 323 Machine-Language Programming) Let's create a computer called the Simpletron. As its lies, it's a simple machine, but powerful. The Simpletron runs programs written in the name im ls l anguage it directly understands: Simpletron Machine Language (SML.). impletron contains an accumulator-a special register in which information is pu letron uses that information in calculations or examines it in various ways tion in the Simpletron is handled in terms of words. A word is a signed four-digit decim before the Simpletron number, such as +3364, -1293, -0007 and -0001. The Simpletron is equipped with a 100-word and these words are referenced by their location numbers 00, 01,... 99. running an SML program, we must load, or place, the program into memory. The first instruction (or statement) of every SML program is always placed in location 00. The simulator will start executing at this location. Each instruction written in SML occupies one word of the Simpletron's memory (so instructions are signed four-digit decimal numbers). We shall assume that the sign of an SML instruction is always plus, but the sign of a data word may be either plus or minus. Each location in the Simpletron's mem- ory may contain an instruction, a data value used by a program or an unused (and so undefined) area of memory. The first two digits of each SML instruction are the operation code specifying the opera- tion to be performed. SML operation codes are summarized in Fig. 7.33. The last two digits of an SML instruction are the operand the address of the memory location containing the word to which the operation applies. Let's consider several simple SML programs. Operation code Meaning Inputloutput operations:
How the solution should look like.................................................
*** Welcome to Simpletron *** *** Please Enter your Program one instrution *** *** (or Data word) at a time. I will type the *** *** location number and question mark (?). *** *** You then type the word for that location. *** *** Type the senitel -99999 to stop entering *** *** your Program
***
00 ? 1099 01 ? 1098 02 ? 2099 03 ? 3398 04 ? 2150 05 ? 1150 06 ? 1199 07 ? 1198 08 ? 4300 09 ? -99999 ****START SIMPLETRON EXECUTION*********** Enter an integer: 4 Enter an integer: 9 Content of 50: 36 Content of 99: 4 Content of 98: 9 ***************SIMPLETRON EXECUTION TERMINATED************** *********** END SIMPLETRON EXECTION**************** REGISTERS: accumulator +0036 instructionCounter 08 instructionRegister +4300 operationalCode 43 operand 00 MEMORY : 0 1 2 3 4 5 6 7 8 9 0 +1099 +1098 +2099 +3398 +2150 +1150 +1199 +1198 +4300 +0000 10 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 20 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 30 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 40 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 50 +0036 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 60 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 70 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 80 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 90 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0000 +0009 +0004
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started