Subroutine - History - Self-modifying Code

Self-modifying Code

The first use of subprograms was on early computers that were programmed in machine code or assembly language, and did not have a specific call instruction. On those computers, each subroutine call had to be implemented as a sequence of lower level machine instructions that relied on self-modifying code. By replacing the operand of a branch instruction at the end of the procedure's body, execution could then be returned to the proper location (designated by the return address) in the calling program (usually just after the instruction that jumped into the subroutine).

Read more about this topic:  Subroutine, History

Famous quotes containing the word code:

    Motion or change, and identity or rest, are the first and second secrets of nature: Motion and Rest. The whole code of her laws may be written on the thumbnail, or the signet of a ring.
    Ralph Waldo Emerson (1803–1882)