1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-17 15:06:29 +00:00
C02/work/funcs.c02

77 lines
2.0 KiB
Plaintext
Raw Normal View History

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
char STROBE; //Strobe Register
2018-03-03 19:35:12 +00:00
/* Function Declarations */
2018-03-03 19:35:12 +00:00
char myfunc();
return b-c-d;
return;
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
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
r[i], z[j], f[b] = testfn(); //Error - Array Element not Allowed with STX assignment
2018-03-03 19:35:12 +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