Pristine Ack-5.5
[Ack-5.5.git] / mach / i80 / ncg / mach.c
1 /*
2  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3  * See the copyright notice in the ACK home directory, in the file "Copyright".
4  *
5  */
6
7 #ifndef NORCSID
8 static char rcsid[]=    "$Id: mach.c,v 1.6 1994/06/24 12:58:05 ceriel Exp $" ;
9 #endif
10
11 /*
12  * machine dependent back end routines for the Intel 8080.
13  */
14
15 con_part(sz,w) register sz; word w; {
16
17         while (part_size % sz)
18                 part_size++;
19         if (part_size == 2)
20                 part_flush();
21         if (sz == 1) {
22                 w &= 0xFF;
23                 if (part_size)
24                         w <<= 8;
25                 part_word |= w;
26         } else {
27                 assert(sz == 2);
28                 part_word = w;
29         }
30         part_size += sz;
31 }
32
33 long atol();
34
35 con_mult(sz) word sz; {
36
37         if (argval != 4)
38                 fatal("bad icon/ucon size");
39         fprintf(codefile,".data4\t%ld\n",atol(str));
40 }
41
42 con_float() {
43         static int warning_given;
44         int i = argval;
45
46         if (!warning_given) {
47                 fprintf(stderr, "warning: dummy floating point constant\n");
48                 warning_given = 1;
49         }
50         while (i > 0) {
51                 fputs(".data4 0 !dummy float\n", codefile);
52                 i -= 4;
53         }
54 }
55
56
57 prolog(nlocals) full nlocals; {
58
59         fprintf(codefile,"\tpush\tb\n\tlxi\th,0\n\tdad\tsp\n\tmov\tb,h\n\tmov\tc,l\n");
60         switch (nlocals) {
61         case 4: fprintf(codefile,"\tpush\th\n");
62         case 2: fprintf(codefile,"\tpush\th\n");
63         case 0: break;
64         default:
65                 fprintf(codefile,"\tlxi\th,%d\n\tdad\tsp\n\tsphl\n",-nlocals);
66                 break;
67         }
68 }
69
70 mes(type) word type ; {
71         int argt ;
72
73         switch ( (int)type ) {
74         case ms_ext :
75                 for (;;) {
76                         switch ( argt=getarg(
77                             ptyp(sp_cend)|ptyp(sp_pnam)|sym_ptyp) ) {
78                         case sp_cend :
79                                 return ;
80                         default:
81                                 strarg(argt) ;
82                                 fprintf(codefile,".define %s\n",argstr) ;
83                                 break ;
84                         }
85                 }
86         default :
87                 while ( getarg(any_ptyp) != sp_cend ) ;
88                 break ;
89         }
90 }
91
92 char *segname[] = {
93         ".sect .text",
94         ".sect .data",
95         ".sect .rom",
96         ".sect .bss"
97 };