Problem Statement
Assume that ALPHA and BETA are the two arrays of 100 words. Another array of GAMMA elements are obtained by multiplying the corresponding ALPHA element by 4 and adding the corresponding BETA elements.
Solution
| Line Number | Code | Comments |
| 1 | LDS #3 | |
| 2 | LDT #300 | |
| 3 | LDX #0 | |
| 4 | ADDLOOP LDA ALPHA, X | |
| 5 | MUL #4 | |
| 6 | ADD BETA, X | |
| 7 | STA GAMMA, X | |
| 8 | ADDR S, X | |
| 9 | COMPR X, T | |
| 10 | JLT ADDLOOP | |
| 11 | ALPHA RESW 100 | |
| 12 | BETA RESW 100 | |
| 13 | GAMMA RESW 100 |
Leave a Reply