Microprocessor Simulator 0 Help



Download 1.18 Mb.
Page54/82
Date18.03.2021
Size1.18 Mb.
#56105
1   ...   50   51   52   53   54   55   56   57   ...   82
sms32v50 (3)
sms32v50 (3), sms32v50 (6)

Passing Parameters


Parameters can be passed in three ways.

  1. CPU registers can be used - Fast but little data can be passed. In some programming languages the "Register" keyword is used to achieve this.

  2. RAM locations can be used - Slower and recursion may not be possible. In some programming languages the "Static" keyword is used to achieve this. This technique is useful if very large amounts of data are help in RAM. Passing a pointer to the data is more efficient than making a copy of the data on the stack.

  3. The stack can be used - Harder to understand and code but a lot of data can be passed and recursion is possible. Compilers generally use this method by default unless otherwise directed.

The example program uses all three methods to add two numbers together. The example tasks involve all three methods.



Download 1.18 Mb.

Share with your friends:
1   ...   50   51   52   53   54   55   56   57   ...   82




The database is protected by copyright ©ininet.org 2024
send message

    Main page