System Software – SIC/XE Program to find the maximum element in the array and store result in MAX

Problem Statement

Assume that ALPHA is an array of 100 words. Write a sequence of instructions for SIC/XE to find the maximum element in the array and store results in MAX.

Solution

Line NumberCodeComment
 LDS #3 
 LDT #300 
 LDX #0 
 CLOOP LDA ALPHA, X 
 COMP MAX 
 JLT NOCH 
 STA MAX 
 NOCH ADDR S, X 
 COMPR X, T 
 JLT CLOOP 
 ALPHA RESW 100 
 MAX WORD -32768