annotate test/comp.c @ 751:c921670e2ce8

i64 continue... 64bit register
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 14 Nov 2010 04:56:02 +0900
parents c2c709727221
children 5313ed059cee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
704
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
1 extern int printf(const char *,...);
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
2
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
3 int heapsize;
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
4 #if 1
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
5 #define CHECK_HEAP(b) ({int _k=(int)(b);if(_k>heapsize||_k<=0)error(-1);_k;})
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
6 #else
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
7 #define CHECK_HEAP(b) (b)
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
8 #endif
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
9
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
10 #define car(e) (heap[(int)(CHECK_HEAP(e))])
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
11
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
12 #define cadr(e) (heap[((int)(CHECK_HEAP(e)))+1])
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
13
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
14 #define caddr(e) (heap[((int)(CHECK_HEAP(e)))+2])
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
15
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
16 #define cadddr(e) (heap[((int)(CHECK_HEAP(e)))+3])
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
17
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
18 #define caddddr(e) (heap[((int)(CHECK_HEAP(e)))+4])
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
19
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
20 #define HEAP_SIZE (1024)
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
21
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
22 #if 0
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
23 int heap0[HEAP_SIZE];
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
24 int *heap = heap0;
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
25 #else
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
26 int heap[HEAP_SIZE];
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
27 #endif
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
28
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
29 int v;
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
30
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
31 void
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
32 error(int v)
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
33 {
748
c2c709727221 i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 704
diff changeset
34 printf("#0033:error %d\n",v);
704
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
35 }
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
36
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
37 int
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
38 main()
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
39 {
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
40 int j;
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
41
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
42 heapsize = HEAP_SIZE;
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
43
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
44 for(j=1;j<5;j++)
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
45 caddr(j) = j;
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
46 v = 5;
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
47
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
48 for(j=0;j<5;j++)
748
c2c709727221 i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 704
diff changeset
49 printf("#0048:%d\n",caddr(j));
704
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
50
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
51 for(j=1,v=5;j<5;j++,v++)
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
52 caddr(v) = cadr(j);
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
53
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
54 for(j=5;j<=v;j++)
748
c2c709727221 i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 704
diff changeset
55 printf("#0054:%d\n",caddr(j));
704
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
56
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
57 caddr(HEAP_SIZE+5);
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
58
6e6dc2d644ed *** empty log message ***
kono
parents:
diff changeset
59 }