Task 1:
INP - input the first value
STA FIRST - the input is stores in the memory address FIRST
INP - input the second value
ADD FIRST - Add the value in the memory address FIRST to the second value inputted
OUT - output the result
INP - the third value is inputted
SUB FIRST - Subtract the value in the memory address FIRST from the third value inputted
OUT - output the result
HLT - Finish the program (stops)
Task 2:
INP - input the first value
STA FIRST - Store the value in the memory address FIRST
INP - input a second value
STA SECOND - Store the second value in the memory address SECOND
LDA FIRST - Load the value in the memory address FIRST
OUT - Output this value (found in FIRST)
LDA SECOND - Load the value in the memory address SECOND
OUT - Output this value (found in SECOND)
HLT - Finish the program
FIRST DAT - Declare FIRST as the next available memory address
SECOND DAT - Declare SECOND as the next available memory address (after FIRST)
No comments:
Post a Comment