1989-02-02 14:41:24 +00:00
|
|
|
#include "header.h"
|
1987-11-20 10:41:03 +00:00
|
|
|
|
1988-06-20 11:40:31 +00:00
|
|
|
/* This file contains low-level routines for generating assembly code. */
|
1987-11-20 10:41:03 +00:00
|
|
|
|
1989-02-02 14:41:24 +00:00
|
|
|
int cur_seg = -1, saved = 0;
|
1987-11-20 10:41:03 +00:00
|
|
|
char name[256], labeltje[256];
|
|
|
|
|
|
|
|
File *codefile;
|
|
|
|
|
|
|
|
|
|
|
|
align_word()
|
|
|
|
|
|
|
|
/* The EM-definition demands that segments are aligned at a word boundary
|
|
|
|
*/
|
|
|
|
|
|
|
|
{
|
|
|
|
switch ( cur_seg) {
|
|
|
|
case SEGTXT : return;
|
|
|
|
default : fprint( codefile, ALIGN_FMT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
save_label( l)
|
|
|
|
char *l;
|
|
|
|
{
|
|
|
|
sprint( labeltje, "%s", l);
|
1989-02-02 14:41:24 +00:00
|
|
|
saved = 1;
|
1987-11-20 10:41:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dump_label()
|
|
|
|
{
|
|
|
|
if ( saved) {
|
|
|
|
align_word();
|
|
|
|
symbol_definition( labeltje);
|
|
|
|
}
|
1989-02-02 14:41:24 +00:00
|
|
|
saved = 0;
|
1987-11-20 10:41:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1988-11-18 17:52:39 +00:00
|
|
|
char *extnd_pro( prcno)
|
|
|
|
int prcno;
|
1987-11-20 10:41:03 +00:00
|
|
|
{
|
1988-11-18 17:52:39 +00:00
|
|
|
sprint( name, "pro%d", prcno);
|
1987-11-20 10:41:03 +00:00
|
|
|
return( name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1988-11-18 17:52:39 +00:00
|
|
|
char *extnd_start( prcno)
|
|
|
|
int prcno;
|
1987-11-20 10:41:03 +00:00
|
|
|
{
|
1988-11-18 17:52:39 +00:00
|
|
|
sprint( name, "start%d", prcno);
|
1987-11-20 10:41:03 +00:00
|
|
|
return( name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char *extnd_name( s)
|
|
|
|
char *s;
|
|
|
|
{
|
|
|
|
sprint( name, NAME_FMT, s);
|
|
|
|
return( name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char *extnd_dnam( s)
|
|
|
|
char *s;
|
|
|
|
{
|
|
|
|
sprint( name, DNAM_FMT, s);
|
|
|
|
return( name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char *extnd_dlb( g)
|
|
|
|
arith g;
|
|
|
|
{
|
1989-02-02 14:41:24 +00:00
|
|
|
sprint( name, DLB_FMT, (long)g);
|
1987-11-20 10:41:03 +00:00
|
|
|
return( name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1988-11-18 17:52:39 +00:00
|
|
|
char *extnd_ilb( l, prcno)
|
1987-11-20 10:41:03 +00:00
|
|
|
arith l;
|
|
|
|
{
|
1989-02-02 14:41:24 +00:00
|
|
|
sprint( name, ILB_FMT, prcno, (long) l);
|
1987-11-20 10:41:03 +00:00
|
|
|
return( name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char *extnd_hol( hol)
|
|
|
|
int hol;
|
|
|
|
{
|
|
|
|
sprint( name, HOL_FMT, hol);
|
|
|
|
return( name);
|
|
|
|
}
|
1988-09-08 10:01:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
char *extnd_part( d)
|
|
|
|
int d;
|
|
|
|
{
|
1989-02-02 14:41:24 +00:00
|
|
|
sprint( name, "part%x", d);
|
1988-09-08 10:01:32 +00:00
|
|
|
return( name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char *extnd_cont( d)
|
|
|
|
int d;
|
|
|
|
{
|
1989-02-02 14:41:24 +00:00
|
|
|
sprint( name, "cont%x", d);
|
1988-09-08 10:01:32 +00:00
|
|
|
return( name);
|
|
|
|
}
|