System Software
Faculty: SHIBU V S
Module:2
Topic: SIC and SIC/XE Programming
Assembler Directives
WORD - reserves one word of storage,which is initialized to a value
defined in the operand field of the statement
RESW - reserves one or more words of storage for use by the program.
BYTE - reserves one byte of storage,which is initialized to a value
defined in the operand field of the statement
RESB - reserves one or more characters of storage for use by the
program.
Program No:1- SIC
Data Movement Operations
Program No:1 -SIC/XE
Data Movement Operations
Program No:2- Arithmetic Operations-SIC
Program No:2- Arithmetic Operations-SIC/XE
Program No:3 - Looping and Indexing-SIC
Program No:3- Looping and Indexing-SIC/XE
Program No:4-Sample I/O operations in SIC
Program No:5-Subroutine-SIC
Program No:5-Subroutine-SIC/XE
Exercise-1
Write a sequence of instructions for SIC to set ALPHA equal to the
product of BETA and GAMMA. Assume that ALPHA,BETA and GAMMA
are defined.
Exercise-1 Solution
Exercise-2
Write Sequence of instructions for SIC/XE to set ALPHA equal to
4*BETA-9. Assume that ALPHA and BETA are defined. Use immediate
addressing for the constants.
Exercise-2 Solution
BETA RESW 1
Exercise-3
Write SIC Instructions to SWAP the values of ALPHA and BETA.
Exercise-3 Solution
Exercise-4
Write a sequence of instructions for SIC to set ALPHA equal to the
integer portion of BETA / GAMMA. Assume that ALPHA and BETA are
defined.
Exercise-4 Solution
Program No:4 - Looping and Indexing-SIC
The variable ALPHA,BETA and GAMMA are arrays of 100 words
each.Write a SIC and SIC/XE program to add the corresponding
elements of ALPHA and BETA, storing the results in the elements of
GAMMA.
Exercise-No:5
Write a sequence of instructions for SIC to clear a 20-byte string to all
blanks.
Exercise-No:5-Solution
Exercise-No:6
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.
Exercise-No:6-Solution
Exercise-No:7
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.
Exercise-No:7 -Solution
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
Exercise-No:8
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.
Exercise-No:8-Solution
Exercise-No:9
Suppose that RECORD contains a 100-byte record. Write a subroutine
for SIC that will write this record onto device 05.
Exercise-No:9-Solution
JSUB WRREC
:
:
WRREC LDX ZERO
WLOOP TD OUTPUT
JEQ WLOOP
LDCH RECORD, X
WD OUTPUT
TIX LENGTH
JLT WLOOP
RSUB
:
:
ZERO WORD 0
LENGTH WORD 1
OUTPUT BYTE X ‘05’
RECORD RESB 100
Exercise-No:10
Suppose that RECORD contains a 100-byte record. Write a subroutine
for SIC/XE that will write this record onto device 05.Use immediate
addressing and register-to-register instructions to make the process as
efficient as possible.
Exercise-No:10-Solution