System Software – SIC program to set 100 elements of array to Zero

Problem Statement

Suppose that ALPHA is an array of 100 words, as defined in Fig. 1.5(a). Write a sequence of instructions for SIC to set all 100 elements of the array to 0.

Solution

Line Number(ac)CodeDescription
1LDA ZERO 
2STA INDEX 
3LOOP LDX INDEX 
4LDA ZERO 
5STA ALPHA, X 
6LDA INDEX 
7ADD THREE 
8STA INDEX 
9COMP K300 
10TIX TWENTY 
11JLT LOOP 
12INDEX RESW 1 
13ALPHA RESW 100 
14ZERO WORD 0 
15K300 WORD 100 
16THREE WORD 3 
%d