Pristine Ack-5.5
[Ack-5.5.git] / mach / 6500 / cg / mach.c
1 /* $Id: mach.c,v 1.8 1994/06/24 12:54:26 ceriel Exp $ */
2 /*
3  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
4  * See the copyright notice in the ACK home directory, in the file "Copyright".
5  */
6 con_part(sz,w) register sz; word w; {
7
8         while (part_size % sz)
9                 part_size++;
10         if (part_size == TEM_WSIZE)
11                 part_flush();
12         if (sz == 1) {
13                 w &= 0xFF;
14                 if (part_size)
15                         w <<= 8;
16                 part_word |= w;
17         } else {
18                 assert(sz == 2);
19                 part_word = w;
20         }
21         part_size += sz;
22 }
23
24 con_mult(sz) word sz; {
25         long atol();
26
27         if (sz != 4)
28                 fatal("bad icon/ucon size");
29         fprintf(codefile,".data4 %ld\n", atol(str));
30 }
31
32
33 con_float() {
34
35 static int been_here;
36         if (argval != 4 && argval != 8)
37                 fatal("bad fcon size");
38         fprintf(codefile,".data4\t");
39         if (argval == 8)
40                 fprintf(codefile,"F_DUM,");
41         fprintf(codefile,"F_DUM\n");
42         if ( !been_here++)
43         {
44         fprintf(stderr,"Warning : dummy float-constant(s)\n");
45         }
46 }
47
48 prolog(nlocals) full nlocals; {
49
50         fprintf(codefile,"\tjsr Pro\n");
51         if (nlocals == 0)
52                 return;
53         else
54                 fprintf(codefile,
55         "\tldx #[%d].h\n\tlda #[%d].l\n\tjsr Lcs\n",
56                                         nlocals, nlocals);
57 }
58
59 mes(type) word type; {
60         int argt ;
61
62         switch ( (int)type ) {
63         case ms_ext :
64                 for (;;) {
65                         switch ( argt=getarg(
66                             ptyp(sp_cend)|ptyp(sp_pnam)|sym_ptyp) ) {
67                         case sp_cend :
68                                 return ;
69                         default:
70                                 strarg(argt) ;
71                                 fprintf(codefile,".define %s\n",argstr) ;
72                                 break ;
73                         }
74                 }
75         default :
76                 while ( getarg(any_ptyp) != sp_cend ) ;
77                 break ;
78         }
79 }
80
81 char    *segname[] = {
82         ".sect .text",        /* SEGTXT */
83         ".sect .data",        /* SEGCON */
84         ".sect .rom",        /* SEGROM */
85         ".sect .bss"          /* SEGBSS */
86 };