Com 212 intro to system programming book Theory



Download 0.65 Mb.
View original pdf
Page21/72
Date13.05.2021
Size0.65 Mb.
#56617
1   ...   17   18   19   20   21   22   23   24   ...   72
com-212-introduction-to-system-programming-theory
9833 SS1 FISHERY LESSON NOTE
Op
Code
Function
Abbreviation
Task
0
INP Stores the next value from the input stream into the specified memory block. Every time this opcode is called the next value in the list is read and stored. For example,
001 means store the next value in the input stream in memory block 01.
1
CLA Clears the accumulator (reset content to 0) and adds the content of the specified memory location to the accumulator.
2 ADD Adds the content of the specified memory location to the accumulator without clearing the accumulator first.
3
TAC Tests the value in the accumulator, if it is negative it jumps to the specified memory block. For example, 325 means check the content of the accumulator, if it is negative set the program counter to 25, go to memory block 25, and execute the command stored in it.
4
SFT This opcode is followed by two digit operands. The first indicates the number of places to shift the content of the accumulator to the left and the second indicates the number of places to shift the content of the accumulator to the right. The left shift is implemented before the right shift. Note that you do not have to have nonzero shifts in both directions. You could set the value to 0 for the direction in which you do not wish to shift. For example consider the instruction 401 and the value in the accumulator is 2121. We see that the amount of shift to the left is 0 so no shift to the left. The amount of shift to the right is 1 so we move all digits of the accumulator to the right one place dropping the rightmost digit we get 212. Shifting 1 place to the right is analogous to getting the

Page | 27 quotient of the division of the accumulator’s content by 10. Lets try another example, 420. The accumulator again contains 2121 initially. The amount of shift to the left is 2 so we move all digits of the accumulator’s content to the left two places and add a zero to the right for everyplace we shift we get 2100. The first 2 digits are truncated because the accumulator is only four positions in length. Shifting 1 place to the left is like multiplying the accumulator’s content by 10.
5 OUT Outputs the content of the specified memory block. For example, 501 means output the content of memory block
01.
6
STO Stores the content of the accumulator in the specified memory block. For example, 601 means store the content of the accumulator into memory block 01.
7 SUB Subtracts the content of the specified memory block from the content of the accumulator. For example, 701 means subtract the content of memory block 01 from the content of the accumulator.
8
JMP Jumps to the specified memory block unconditionally. For example, 825 means set the program counter to 25, go to memory block 25, and execute the command stored in it.
9 HRS Halts or ends the program. We always use 900.

Download 0.65 Mb.

Share with your friends:
1   ...   17   18   19   20   21   22   23   24   ...   72




The database is protected by copyright ©ininet.org 2024
send message

    Main page