System Software – SIC/XE Program to divide BETA by GAMMA and set quotient and remainder

Problem Statement

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.

Solution

Line Number(ac)CodeDescription
1LDA BETALoad the value of BETA to accumulator
2LDS GAMMALoad the value of GAMMA to register S
3DIVR S, ADivide the value of accumulator with the Register S
4STA ALPHAStore the accumulator value to ALPHA
5MULR S, AMultiply the value of accumulator with Register S and store the result in accumulator.
6LDS BETALoad the value of BETA to Register S
7SUBR A, SSubtract the value of Register S from Accumulator  and store the result in Register A
8STS DELTAStore the value of register S to DELTA
9ALPHA RESW 1Reserve 1 word for ALPHA
10BETA RESW 1Reserve 1 word for BETA
11GAMMA RESW 1Reserve 1 word for GAMMA
12DELTA RESW 1Reserve 1 word for DELTA