Pristine Ack-5.5
[Ack-5.5.git] / util / ceg / ce_back / obj_back / gen4.c
1 #include <system.h>
2 #include "mach.h"
3 #include "back.h"
4 #undef text2
5 #undef con2
6 #ifdef BYTES_REVERSED
7 #define text2(w)        { *text++ = ((w) >> 8); *text++ = (w);}
8 #define con2(w)         { *data++ = ((w) >> 8); *data++ = (w);}
9 #else
10 #define text2(w)        { *text++ = (w); *text++ = ((w)>>8);}
11 #define con2(w)         { *data++ = (w); *data++ = ((w)>>8);}
12 #endif
13  
14 gen4( l)
15 FOUR_BYTES l;
16 {
17         switch ( cur_seg) {
18                 case SEGTXT :
19                         if ((text_cnt -= 4) < 0) mem_text();
20 #ifdef WORDS_REVERSED
21                         text2( (int) (l>>16));
22                         text2( (int) l);
23 #else
24                         text2( (int) l);
25                         text2( (int) (l>>16));
26 #endif
27                         return;
28                 case SEGCON  :
29                 case SEGROM  :
30                         if ((data_cnt -= 4) < 0) mem_data();
31 #ifdef WORDS_REVERSED
32                         con2( (int)(l>>16));
33                         con2( (int) l);
34 #else
35                         con2( (int) l);
36                         con2( (int) (l>>16));
37 #endif
38                         return;
39                 case SEGBSS  : bss( (arith) 4);
40                                return;
41                 default      : fprint( STDERR, "gen4() : bad seg number\n");
42                                return;
43         }
44 }