2018-03-03 19:35:12 +00:00
|
|
|
/****************************
|
|
|
|
* Test C02 Function Calls *
|
|
|
|
* Test file for Compiler *
|
|
|
|
****************************/
|
|
|
|
|
|
|
|
/* Variables */
|
|
|
|
char b ,
|
|
|
|
i , j;
|
|
|
|
char c,d,f;
|
|
|
|
char r[15];
|
|
|
|
char z[15];
|
2018-08-04 22:29:04 +00:00
|
|
|
const char t = {1, 2, 3, 4, 5};
|
|
|
|
const char s = "This is a string.";
|
2018-03-03 19:35:12 +00:00
|
|
|
char aa,xx,yy ; //Function parameter variables
|
|
|
|
char aaa,xxx,yyy ; //Function return variables
|
2018-07-22 00:51:41 +00:00
|
|
|
char STROBE; //Strobe Register
|
2018-03-03 19:35:12 +00:00
|
|
|
|
2018-07-22 00:51:41 +00:00
|
|
|
/* Function Declarations */
|
2018-03-03 19:35:12 +00:00
|
|
|
char myfunc();
|
|
|
|
return b-c-d;
|
|
|
|
return;
|
|
|
|
|
2018-07-22 00:51:41 +00:00
|
|
|
char func1(aa) {
|
|
|
|
return aa;
|
|
|
|
}
|
|
|
|
|
|
|
|
char func2(aa, yy) {
|
|
|
|
return aa + yy;
|
|
|
|
}
|
|
|
|
|
|
|
|
char func3(aa, yy, xx) {
|
|
|
|
return aa + yy - xx;
|
|
|
|
}
|
|
|
|
|
2018-03-03 19:35:12 +00:00
|
|
|
main:
|
|
|
|
|
|
|
|
funcx:
|
|
|
|
f = testfn(b); //Simple Variable
|
|
|
|
f = testfn(r[i]); //Array Element
|
|
|
|
f = testfn(r[i],b); //Two Parameters
|
|
|
|
f = testfn(r[1],r[2]); //Two Array Elements
|
|
|
|
f = testfn(r[1],r[2],b); //Three Parameters
|
|
|
|
f = testfn(&s); //Pointer
|
|
|
|
f = testfn(b,&s); //Byte and Pointer
|
|
|
|
f = testfn(r[i],&s); //Array Element and Pointer
|
|
|
|
f = testfn(r[1],&s); //Array Element and Pointer
|
|
|
|
f = testfn(b+c+d,&s); //Expression in Function Call
|
|
|
|
f = testfn(getkey(b)+c); //Nested Function Call
|
|
|
|
|
|
|
|
funcs:
|
|
|
|
prchr(b+c+d);
|
|
|
|
testfn(prchr(b));
|
|
|
|
testfn(b,c,d);
|
|
|
|
testfn(b+c+d,r[i],f);
|
|
|
|
testfn(&s); //Print a String
|
2019-05-05 01:56:00 +00:00
|
|
|
dofn(?,yy);
|
|
|
|
dofn(?,yy,xx);
|
|
|
|
dofn(aa,?,xx);
|
|
|
|
dofn(?,?,XX);
|
2018-03-03 19:35:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
funcyx:
|
|
|
|
aaa = testfn(); //Return 1 Value
|
|
|
|
aaa, yyy = testfn(); //Return 2 Values
|
|
|
|
aaa, yyy, xxx = testfn(); //Return 3 Values
|
|
|
|
r[i], d = testfn(); //Return 2 Values with Array
|
|
|
|
c, z[i] = testfn(); //Return 2 Values with Array
|
|
|
|
r[i], d, f = testfn(); //Return 3 Values with Array
|
|
|
|
c, z[i], f = testfn(); //Return 3 Values with Array
|
|
|
|
r[i], z[j] = testfn(); //Return 2 Values with Arrays
|
|
|
|
r[i], z[j], f = testfn(); //Return 2 Values with Arrays
|
2018-07-22 02:23:10 +00:00
|
|
|
r[i], z[j], f[b] = testfn(); //Error - Array Element not Allowed with STX assignment
|
2018-03-03 19:35:12 +00:00
|
|
|
|
2018-07-22 00:51:41 +00:00
|
|
|
|
|
|
|
//void fnoutr() {char fninnr() {} }
|
2018-03-03 19:35:12 +00:00
|
|
|
//A, Y = testfn(); //Error - Registers not Allowed when returning multiple values
|