ack/util/ceg/ce_back/obj_back/gen4.c

44 lines
920 B
C
Raw Normal View History

1988-10-20 13:06:10 +00:00
#include <system.h>
1989-01-26 10:52:51 +00:00
#include <em.h>
1987-11-20 10:41:03 +00:00
#include "mach.h"
1988-10-20 13:06:10 +00:00
#include "back.h"
#ifdef BYTES_REVERSED
#define text2(w) { *text++ = ((w) >> 8); *text++ = (w);}
#define con2(w) { *data++ = ((w) >> 8); *data++ = (w);}
#else
#define text2(w) { *text++ = (w); *text++ = ((w)>>8);}
#define con2(w) { *data++ = (w); *data++ = ((w)>>8);}
#endif
1988-10-20 13:06:10 +00:00
gen4( l)
FOUR_BYTES l;
1987-11-20 10:41:03 +00:00
{
1988-10-20 13:06:10 +00:00
switch ( cur_seg) {
case SEGTXT :
if ((_text_cnt -= 4) < 0) mem_text();
#ifdef WORDS_REVERSED
text2( (int) (l>>16));
text2( (int) l);
#else
text2( (int) l);
text2( (int) (l>>16));
#endif
return;
case SEGCON :
case SEGROM :
if ((_data_cnt -= 4) < 0) mem_data();
#ifdef WORDS_REVERSED
con2( (int)(l>>16));
con2( (int) l);
#else
con2( (int) l);
con2( (int) (l>>16));
#endif
return;
1989-01-20 14:54:55 +00:00
case SEGBSS : bss( (arith) 4);
1988-10-20 13:06:10 +00:00
return;
default : fprint( STDERR, "gen4() : bad seg number\n");
return;
}
1987-11-20 10:41:03 +00:00
}