System
System
Write a sequence of instructions for SIC to ALPHA equal to the product of BETA
and GAMMA.
Assembly Code:
LDA BETA
MUL GAMMA
STA ALPHA
:
:
ALPHA RESW 1
BETA RESW 1
GAMMA RESW 1
2. Write a sequence of instructions for SIC/XE to set ALPHA equal to 4 * BETA – 9.
Use immediate addressing for the constants.
Assembly Code:
LDA BETA
LDS #4
MULR S,A
SUB #9
STA ALPHA
:
:
ALPHA RESW 1
3. Write SIC instructions to swap the values of ALPHA and BETA.
Assembly Code:
LDA ALPHA
STA GAMMA
LDA BETA
STA ALPHA
LDA GAMMA
STA BETA
:
:
ALPHA RESW 1
BETA RESW 1
GAMMA RESW 1
4. Write a sequence of instructions for SIC to set ALPHA equal to the integer portion of
BETA ÷ GAMMA.
Assembly Code:
LDA BETA
DIV GAMMA
STA ALPHA
:
:
ALPHA RESW 1
BETA RESW 1
GAMMA RESW 1
5. Write a sequence of instructions for SIC/XE to divide BETA by GAMMA, setting
ALPHA to the integer portion of the quotient and DELTA to the remainder. Use
register-to-register instructions to make the calculation as efficient as possible.
Assembly Code:
LDA BETA
LDS GAMMA
DIVR S, A
STA ALPHA
MULR S, A
LDS BETA
SUBR A, S
STS DELTA
:
:
ALPHA RESW 1
BETA RESW 1
GAMMA RESW 1
DELTA RESW 1
8. Write a sequence of instructions for SIC/XE to clear a 20-byte string to all blanks.
Use immediate addressing and register-to-register instructions to make the process as
efficient as possible.
Assembly Code:
LDT #20
LDX #0
LOOP LDCH #0
STCH STR1,X
TIXR T
JLT LOOP
:
:
STR1 RESW 20
9. Suppose that ALPHA is an array of 100 words, Write a sequence of instructions for
SIC to set all 100 elements of the array to 0.
Assembly Code:
LDA ZERO
STA INDEX
LOOP LDX INDEX
LDA ZERO
STA ALPHA, X
LDA INDEX
ADD THREE
STA INDEX
COMP K300
TIX TWENTY
JLT LOOP
:
:
INDEX RESW 1
ALPHA RESW 100
:
ZERO WORD 0
K300 WORD 100
THREE WORD 3
10. Suppose that ALPHA is an array of 100 words, Write a sequence of instructions for
SIC/XE to set all 100 elements of the array to 0. Use immediate addressing and registerto-register instructions to make the process as
efficient as possible.
Assembly Code:
LDS #3
LDT #300