2018-03-08 19:35:00 +00:00
|
|
|
/* Test C02 define directive */
|
|
|
|
|
|
|
|
#pragma origin 1000
|
|
|
|
|
|
|
|
char d, i;
|
|
|
|
char index, name[8], data[128];
|
|
|
|
|
|
|
|
//Define Structure
|
|
|
|
struct record {
|
|
|
|
char name[8];
|
|
|
|
char index;
|
|
|
|
char data[128];
|
|
|
|
};
|
|
|
|
|
|
|
|
//Declare Structure Variable
|
|
|
|
struct record rec;
|
|
|
|
|
2018-07-30 17:03:54 +00:00
|
|
|
//Display Structure Info
|
|
|
|
printf(@rec,"@rec=%d\n");
|
|
|
|
printf(?rec.name,"?rec.name=%d\t");
|
|
|
|
printf(@rec.name,"@rec.name=%d\n");
|
|
|
|
printf(?rec.index,"?rec.index=%d\t");
|
|
|
|
printf(@rec.index,"@rec.index=%d\n");
|
|
|
|
printf(?rec.data,"?rec.data=%d\t");
|
|
|
|
printf(@rec.data,"@rec.data=%d\n");
|
|
|
|
|
2018-03-08 19:35:00 +00:00
|
|
|
//Set Structure Members
|
|
|
|
strdst(&rec.name); strcpy(name);
|
|
|
|
rec.index = index;
|
|
|
|
for (i = 0; i<=128; i++)
|
|
|
|
rec.data[i] = d;
|
|
|
|
|
|
|
|
//Pass Entire Structure into Function
|
2018-03-09 01:07:31 +00:00
|
|
|
blkput(@rec, &rec);
|
|
|
|
|
|
|
|
//Copy Struct Member
|
|
|
|
memdst(&data); memcpy(@rec.data, &rec.data);
|
2018-03-08 19:35:00 +00:00
|
|
|
|
|
|
|
//Get Structure Members
|
|
|
|
index = rec.index;
|
|
|
|
for (i = 0; i<129; i++)
|
|
|
|
d = rec.data[i];
|
|
|
|
|
2018-07-30 17:03:54 +00:00
|
|
|
//Treat Structure Like an Array
|
2018-03-08 19:35:00 +00:00
|
|
|
for (i = 0; i<140; i++)
|
|
|
|
d = rec[i];
|