
PROGRAMMING CONCEPTS–III 4-17
.STARTUP
PUSH A ;push to stack
PUSH B
PUSH E
PUSH D
CALL COMPUTE ;call the procedure
MOV RESULT, AX ;save AX in memory
.EXIT
COMPUTE PROC NEAR
MOV BP,SP ;copy SP to BP
MOV AX, [BP + 8] ;move the top most stack value to AX
MOV BX, [BP + 6] ;move next word in stack to BX
ADD AX, BX
MOV CX, [BP + 4] ;move the next word to CX
MOV DX, [BP + 2] ;move the next word to DX
ADD CX, DX
SUB AX, CX
RET 8 ;return and add 8 to SP
COMPUTE ENDP
END
Notes The salient features of the program are:
i) A stack of 100 bytes has been defined in the beginning.
ii) The push instructions are in the main program.
iii) ...