home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1996 September
/
PCWK996.iso
/
demo
/
wgelectr
/
emul51
/
examples
/
test.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-09-08
|
3KB
|
130 lines
#include <reg51.h> /* define 8051 registers */
#include <absacc.h>
#include <stdio.h> /* define I/O functions */
#include <string.h>
typedef int word;
int other_module(int,int *);
word evan,laban;
code char _abc_[] = "a string in code memory (\x1,\xCD hex:\t\n)";
xdata char x_abc_[80];
code char *ptr = _abc_;
struct bitfield {
int is_keyword : 1;
unsigned is_extern : 3;
int four : 4;
int is_static : 1;
} flags,flags2;
bit sign0,sign1,sign2,sign3,sign4,sign5,sign6,sign7,sign8;
struct apan {
int member1;
int member2;
struct apan *next;
int member4;
char label[20];
};
static code struct apan MONKEY =
{ 0x4142,0x4344,(struct apan *)(XBYTE+0x89AB),0x40,"STRING_ARRAY_20"};
code struct betan {
unsigned int one,two,three;
char *ptr;
char str[10];
struct apan *monk;
struct betan *nextb;
} hej = { 0x102,0x304,0x506,_abc_,"BETA_0", &MONKEY,0};
code struct betan chej = { 1,2,3,_abc_,"BETA_1", &MONKEY, &hej };
code struct betan *pchej = &chej;
code char *parray[] = { "ABC","DEFG", "IJKLM", "OPQRST",0};
code unsigned int table[] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};
code unsigned int *tbl = table;
code unsigned int **ptbl = &tbl;
code struct tag {
int member;
char name[10];
} list[5] = { /* array of structures */
1001,"ADAM",
1002,"BENNY",
1003,"CINDY",
1004,"DAVID",
1005,"ERIC" };
code struct tag *plist = list;
xdata struct apan Xmonkey;
code struct apan *pMonkey = &MONKEY;
code struct apan *pxmonkey = &Xmonkey;
code struct apan **ppMonkey= &pMonkey;
code float pi = -12.5;
int count(struct apan *arg_p,int arg_counter)
{
char local_1[5];
char _abc_[5];
int local_2;
static code int clocal_3 = 12345;
xdata int xlocal_4;
static code int clocal_5 = 0x1234;
for (local_2 = 0; local_2 < 4; local_2++)
arg_counter++;
strcpy(_abc_,"_cnt");
other_module(evan,&laban);
local_2 = 0xABCD;
return arg_counter;
}
int main(int argc,char *argv[])
{
char ch,local_string[15];
int counter = 0;
struct apan *pointer = &MONKEY;
char _abc_[12];
argc = 10;
ch = argv[1][0];
evan = 0x1000;
laban = 2049;
flags.four = 5;
flags.is_extern = 2;
flags.is_keyword = 0;
flags.is_static = 1;
strcpy(x_abc_,ptr);
strcpy(_abc_,"in main"); /* copy to local variable */
memmove(&Xmonkey,&MONKEY,sizeof(Xmonkey));
sign0 = sign3 = 0;
sign2 = sign1 = 1;
while(1) {
counter = count(pointer,counter);
argc++;
}
}