We received a project to make calculator in assemly
I want to check the result of the numbers actually in the range. that I don't have pverflow or undeflow.
But it does not work .. Can you let me know where the problem so I could fix?
here is my code.
res - is the result of two numbers that was entered by the user. the result is fine i would put here all the code but it is 8 pages.. and temp_num1 and temp_num2 is the numbers.
STEP5, CLA //
BSA OVERUNDER //
BUN STEP6 //
OVERUNDER, HEX 0 //
CLA //
STA V // V = 0
LDA TEMP_NUM1 //
CIL //SHIFT LEFT
CLA //
CIL //SHIFT LEFT
STA MSB_NUM1 // MSB_NUM1 = MSB OF NUM1
LDA TEMP_NUM2 //
CIL //SHIFT RIGHT
CLA //
CIL // SHIFT RIGHT ; =MSB OF NUM2
CMA //
INC //
ADD MSB_NUM1 //
SZA // IF (MSB OF NUM1 == MSB OF NUM2)
BUN FINAL // ELSE, GOTO FINAL
BUN MSB_RES //
MSB_RES, LDA RES //
CIL //SHIFT RIGHT
CLA //
CIL // SHIFT RIGHT; = MSB OF RES
CMA //
INC //
ADD MSB_NUM1 //
SZA // IF (MSB OF RES != msb of NUM1)
BUN NOTINRANGE // ELSE, GOTO NOTINRANGE
BUN FINAL // THEN, GOTO FINAL
NOTINRANGE, LDA FLAG7 //
STA V // V = 1
FINAL, BUN OVERUNDER I // RETURN
//DATA//
MSB_NUM1, DEC 0 //
V, DEC 0 //
FLAG7, DEC 1 //
STEP6, HLT //