Assembly Program for Basic Computer :: Subtract two numbers and Store the result in memory with CONDITION

Q. Write an assembly program for Basic Computer (designed by M. Morris Mano) to subtract two numbers located at 100H and 200H. Then, store the result in 300H if the result is negative, else store zero (0) in 400H.


LDA 200H /AC<-M[200H]
CMA
ADD 100H /AC<-AC+M[100H]
SPA /skip if AC +ve
STA 300H /M[300H]<-AC
SNA /skip if AC -ve
BSA XYZ
HLT /stop i.e. S<-0

XYZ, DEC 0
CLA
STA 400H /M[400H]<-AC
BUN XYZ I



No comments:

Post a Comment