Wednesday 8 June 2016

EXPLAIN SUBROUTINES

A subroutine definition is assembled into object code . it is not repicated during assembly rather dynamic link is established between the ... thumbnail 1 summary
A subroutine definition is assembled into object code . it is not repicated during assembly rather dynamic link is established between the subroutian object code and the points in the programme where the subroutine is needed .
A subroutine is a self contained sequence of instruction that performs given computationl task . each time a subroutine is called a branch is executed to the beginings of subroutine to start executing its set of instructions after the subroutine has been executed, a branch is made to back to the main programme.
A CALL subroutine instructions consists of an operation code together with an address that specified that beginings of the subroutine.

1. the address of the next instruction available in the programme counter is a stored tempoary location so the subroutine knows where to return .
2. control is transfred to the begining of the subroutine .
the last instruction of every subroutine is called RETURN , it transfer the return address from the temporary location into the programme counter . due to this a transfer of programme control to the instruction whose address was originally stored in the temporary location return can be stored

1 comment