372 Arrays Chapter 7 Operation code Meaning Input/output

372 Arrays Chapter 7 Operation code Meaning Input/output operations: final int READ = 10; Read a word from the keyboard into a specific location in memory. final int WRITE = 11; Write a word from a specific location in memory to the screen. Load/store operations: final int LOAD = 20; Load a word from a specific location in memory into the accumulator. final int STORE = 21; Store a word from the accumulator into a specific location in memory. Arithmetic operations: final int ADD = 30; Add a word from a specific location in memory to the word in the accumulator (leave result in the accumulator). final int SUBTRACT = 31; Subtract a word from a specific location in memory from the word in the accumulator (leave result in the accumulator). final int DIVIDE = 32; Divide a word from a specific location in memory into the word in the accumulator (leave result in the accumulator). final int MULTIPLY = 33; Multiply a word from a specific location in memory by the word in the accumulator (leave result in the accumulator). Transfer of control operations: final int BRANCH = 40; Branch to a specific location in memory. final int BRANCHNEG = 41; Branch to a specific location in memory if the accumulator is negative. final int BRANCHZERO = 42; Branch to a specific location in memory if the accumulator is 0. final int HALT = 43; Halt the program has completed its task. Fig. 7.33 Simpletron Machine Language (SML) operation codes . The first SML program (Fig. 7.34) reads two numbers from the keyboard and computes and prints their sum. The instruction +1007 reads the first number from the keyboard and places it into location 07 (which has been initialized to 0). Then, instruction +1008 reads the next number into location 08. The load instruction, +2007, puts the first number into the accumulator, and the add instruction, +3008, adds the second number to the number in the accumulator. All SML arithmetic instructions leave their results in the accumulator. The store instruction, +2109, places the result back into memory location 09 from which the write instruction, +1109, takes the number and prints it (as a signed four-digit decimal number). The halt instruction, +4300, terminates execution. Copyright 1992 2002 by Deitel & Associates, Inc. All Rights Reserved. 7/3/01
Note: If you are looking for cheap and reliable webhost to host and run your web application check Vision coldfusion web hosting services

Leave a Reply