Mercurial > hg > CbC > old > device
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 |
rev | line source |
---|---|
704 | 1 extern int printf(const char *,...); |
2 | |
3 int heapsize; | |
4 #if 1 | |
5 #define CHECK_HEAP(b) ({int _k=(int)(b);if(_k>heapsize||_k<=0)error(-1);_k;}) | |
6 #else | |
7 #define CHECK_HEAP(b) (b) | |
8 #endif | |
9 | |
10 #define car(e) (heap[(int)(CHECK_HEAP(e))]) | |
11 | |
12 #define cadr(e) (heap[((int)(CHECK_HEAP(e)))+1]) | |
13 | |
14 #define caddr(e) (heap[((int)(CHECK_HEAP(e)))+2]) | |
15 | |
16 #define cadddr(e) (heap[((int)(CHECK_HEAP(e)))+3]) | |
17 | |
18 #define caddddr(e) (heap[((int)(CHECK_HEAP(e)))+4]) | |
19 | |
20 #define HEAP_SIZE (1024) | |
21 | |
22 #if 0 | |
23 int heap0[HEAP_SIZE]; | |
24 int *heap = heap0; | |
25 #else | |
26 int heap[HEAP_SIZE]; | |
27 #endif | |
28 | |
29 int v; | |
30 | |
31 void | |
32 error(int v) | |
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 | 35 } |
36 | |
37 int | |
38 main() | |
39 { | |
40 int j; | |
41 | |
42 heapsize = HEAP_SIZE; | |
43 | |
44 for(j=1;j<5;j++) | |
45 caddr(j) = j; | |
46 v = 5; | |
47 | |
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 | 50 |
51 for(j=1,v=5;j<5;j++,v++) | |
52 caddr(v) = cadr(j); | |
53 | |
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 | 56 |
57 caddr(HEAP_SIZE+5); | |
58 | |
59 } |