Added grind support
This commit is contained in:
parent
e4168af8fb
commit
3da953fa85
|
@ -881,3 +881,5 @@ C_prolog ==> .
|
|||
C_jump ==> "bra $1".
|
||||
|
||||
C_locals ==> "link a6, #-$1".
|
||||
|
||||
C_db_sline ==> "jsr (___u_LiB)".
|
||||
|
|
|
@ -777,3 +777,5 @@ C_locals
|
|||
$1 == 4 ==> "clrq -(sp)".
|
||||
$1 == 8 ==> "clrq -(sp)".
|
||||
default ==> "subl2 ~$1, sp".
|
||||
|
||||
C_db_sline ==> "calls ~0, ___u_LiB".
|
||||
|
|
|
@ -145,7 +145,7 @@ t_C_info C_info[] = {
|
|||
{ "str", 0, 0, 0}}
|
||||
}, *C_instr_info;
|
||||
|
||||
#define N_INSTR 269
|
||||
#define N_INSTR 270
|
||||
|
||||
struct { char *name; int class, segment;}
|
||||
EM_instr[ N_INSTR ] = {
|
||||
|
@ -220,6 +220,7 @@ struct { char *name; int class, segment;}
|
|||
{ "C_cuf", NO_ARGS, SEGTXT},
|
||||
{ "C_cui", NO_ARGS, SEGTXT},
|
||||
{ "C_cuu", NO_ARGS, SEGTXT},
|
||||
{ "C_db_sline", NO_ARGS, SEGTXT},
|
||||
{ "C_dch", NO_ARGS, SEGTXT},
|
||||
{ "C_dec", NO_ARGS, SEGTXT},
|
||||
{ "C_dee", EXTERNAL, SEGTXT},
|
||||
|
|
|
@ -27,3 +27,4 @@ symboldef.c
|
|||
text1.c
|
||||
text2.c
|
||||
text4.c
|
||||
dbsym.c
|
||||
|
|
26
util/ceg/ce_back/as_back/dbsym.c
Normal file
26
util/ceg/ce_back/as_back/dbsym.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include "header.h"
|
||||
|
||||
#ifndef OWN_SYMB
|
||||
B_symbstr(s, len, type, add, val, added)
|
||||
char *s, *val;
|
||||
arith added;
|
||||
{
|
||||
if (! s) s = "";
|
||||
fprint(codefile, ".symb \"%s\", %s+%ld, 0x%x, %d\n", s, val, (long) added, type, add);
|
||||
}
|
||||
|
||||
B_symbcst(s, len, type, add, val)
|
||||
char *s;
|
||||
arith val;
|
||||
{
|
||||
if (! s) s = "";
|
||||
fprint(codefile, ".symb \"%s\", %ld, 0x%x, %d\n", s, val, type, add);
|
||||
}
|
||||
|
||||
B_symd(s, len, type, add)
|
||||
char *s;
|
||||
{
|
||||
if (! s) s = "";
|
||||
fprint(codefile, ".symd \"%s\", 0x%x, %d\n", s, type, add);
|
||||
}
|
||||
#endif
|
|
@ -17,7 +17,7 @@ all: bottom.$(SUF) con1.$(SUF) con2.$(SUF) con4.$(SUF) end_back.$(SUF) \
|
|||
reloc2.$(SUF) reloc4.$(SUF) bss.$(SUF) rom1.$(SUF) rom2.$(SUF) \
|
||||
rom4.$(SUF) set_global.$(SUF) set_local.$(SUF) switchseg.$(SUF) \
|
||||
symboldef.$(SUF) do_open.$(SUF) do_close.$(SUF) text1.$(SUF) \
|
||||
text2.$(SUF) text4.$(SUF)
|
||||
text2.$(SUF) text4.$(SUF) dbsym.$(SUF)
|
||||
|
||||
bottom.$(SUF) : $(SRC_DIR)/mach.h back.h header.h $(SOURCE)/bottom.c
|
||||
$(CC) $(CFLAGS) -c $(SOURCE)/bottom.c
|
||||
|
@ -93,3 +93,6 @@ switchseg.$(SUF) : header.h back.h $(SRC_DIR)/mach.h $(SOURCE)/switchseg.c
|
|||
|
||||
symboldef.$(SUF) : header.h back.h $(SRC_DIR)/mach.h $(SOURCE)/symboldef.c
|
||||
$(CC) $(CFLAGS) -c $(SOURCE)/symboldef.c
|
||||
|
||||
dbsym.$(SUF) : header.h back.h $(SRC_DIR)/mach.h $(SOURCE)/dbsym.c
|
||||
$(CC) $(CFLAGS) -c $(SOURCE)/dbsym.c
|
||||
|
|
|
@ -33,3 +33,4 @@ symtable.c
|
|||
text2.c
|
||||
text4.c
|
||||
common.c
|
||||
dbsym.c
|
||||
|
|
|
@ -77,9 +77,9 @@ char *s;
|
|||
|
||||
|
||||
char *extnd_dlb( g)
|
||||
arith g;
|
||||
label g;
|
||||
{
|
||||
string_lengte = mysprint( DLB_FMT, (arith)g);
|
||||
string_lengte = mysprint( DLB_FMT, (long)g);
|
||||
index_symbol_table = find_sym( string, STORE_STRING);
|
||||
return( symbol_table[ index_symbol_table].on_foff + string_area);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ arith g;
|
|||
char *extnd_ilb( l, prcno)
|
||||
arith l;
|
||||
{
|
||||
string_lengte = mysprint( ILB_FMT, prcno, (arith) l);
|
||||
string_lengte = mysprint( ILB_FMT, prcno, (long) l);
|
||||
index_symbol_table = find_sym( string, STORE_STRING);
|
||||
return( symbol_table[ index_symbol_table].on_foff + string_area);
|
||||
}
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
#define SYMBOL_DEFINITION 1
|
||||
#define REFERENCE 2
|
||||
#define STORE_STRING 3
|
||||
#define FORCE_DEF 4
|
||||
|
||||
#define conv_seg( s) ( ( s == SEGROM) ? SEGCON : s)
|
||||
|
|
|
@ -94,12 +94,13 @@ reduce_name_table()
|
|||
* After that, the string table is reduced.
|
||||
*/
|
||||
|
||||
#define S_NEEDED 0x8000
|
||||
#define removable(nm) (!(nm.on_type & S_NEEDED) && *(nm.on_foff+string_area) == GENLAB)
|
||||
#define S_NEEDED S_MOD
|
||||
#define removable(nm) (!(nm->on_type & (S_NEEDED|S_STB)) && *(nm->on_foff+string_area) == GENLAB)
|
||||
|
||||
register int *diff_index =
|
||||
(int *) Malloc((unsigned)(nname + 1) * sizeof(int));
|
||||
register struct outrelo *rp = reloc_info;
|
||||
register struct outname *np;
|
||||
register int i;
|
||||
char *new_str;
|
||||
register char *p, *q;
|
||||
|
@ -113,22 +114,31 @@ reduce_name_table()
|
|||
rp++;
|
||||
}
|
||||
|
||||
for (i = 0; i < nname; i++) {
|
||||
for (i = 0, np = symbol_table; i < nname; i++, np++) {
|
||||
diff_index[i] = diff_index[i-1];
|
||||
if (removable(symbol_table[i])) {
|
||||
if (removable(np)) {
|
||||
diff_index[i]++;
|
||||
}
|
||||
if ((np->on_type & S_TYP) == S_CRS) {
|
||||
struct outname *n = &symbol_table[(int) np->on_valu];
|
||||
if (! (n->on_type & S_COM)) {
|
||||
np->on_type &= ~S_TYP;
|
||||
np->on_type |= (n->on_type & S_TYP);
|
||||
np->on_valu = n->on_valu;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rp = reloc_info;
|
||||
for (i = 0; i < nrelo; i++) {
|
||||
symbol_table[rp->or_nami].on_type &= ~S_NEEDED;
|
||||
rp->or_nami -= diff_index[rp->or_nami];
|
||||
rp++;
|
||||
}
|
||||
for (i = 0; i < nname; i++) {
|
||||
register struct outname *np = &symbol_table[i];
|
||||
|
||||
np->on_type &= ~S_NEEDED;
|
||||
for (i = 0, np = symbol_table; i < nname; i++, np++) {
|
||||
if ((np->on_type & S_TYP) == S_CRS) {
|
||||
np->on_valu -= diff_index[(int) np->on_valu];
|
||||
}
|
||||
if (diff_index[i] && diff_index[i] == diff_index[i-1]) {
|
||||
symbol_table[i - diff_index[i]] = *np;
|
||||
}
|
||||
|
@ -138,14 +148,20 @@ reduce_name_table()
|
|||
free((char *)(diff_index-1));
|
||||
|
||||
new_str = q = Malloc((unsigned)(string - string_area));
|
||||
for (i = 0; i < nname; i++) {
|
||||
p = symbol_table[i].on_foff + string_area;
|
||||
symbol_table[i].on_foff = q - new_str;
|
||||
for (i = 0, np = symbol_table; i < nname; i++, np++) {
|
||||
p = np->on_foff + string_area;
|
||||
np->on_foff = q - new_str;
|
||||
while (*q++ = *p) p++;
|
||||
}
|
||||
free(string_area);
|
||||
string_area = new_str;
|
||||
string = q;
|
||||
for (i = 0, np = symbol_table; i < nname; i++, np++) {
|
||||
if ((np->on_type & S_TYP) == S_CRS) {
|
||||
/* replace by reference to string */
|
||||
np->on_valu = symbol_table[(int) np->on_valu].on_foff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wr_fatal()
|
||||
|
@ -160,10 +176,13 @@ convert_outname( header)
|
|||
struct outhead *header;
|
||||
{
|
||||
int i;
|
||||
register struct outname *np;
|
||||
register long l = OFF_CHAR(*header);
|
||||
|
||||
for ( i=0; i < nname; i++) {
|
||||
symbol_table[ i].on_foff += OFF_CHAR( *header);
|
||||
for (i = 0, np = symbol_table; i < nname; i++, np++) {
|
||||
np->on_foff += l;
|
||||
if ((np->on_type & S_TYP) == S_CRS) {
|
||||
np->on_valu += l;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@ all: data.$(SUF) con2.$(SUF) con4.$(SUF) relocation.$(SUF) end_back.$(SUF) \
|
|||
reloc1.$(SUF) reloc2.$(SUF) reloc4.$(SUF) rom2.$(SUF) rom4.$(SUF) \
|
||||
set_global.$(SUF) set_local.$(SUF) switchseg.$(SUF) symboldef.$(SUF) \
|
||||
text2.$(SUF) text4.$(SUF) do_open.$(SUF) do_close.$(SUF) memory.$(SUF) \
|
||||
label.$(SUF) misc.$(SUF) extnd.$(SUF) symtable.$(SUF) common.$(SUF)
|
||||
label.$(SUF) misc.$(SUF) extnd.$(SUF) symtable.$(SUF) common.$(SUF) \
|
||||
dbsym.$(SUF)
|
||||
|
||||
data.$(SUF) : data.h back.h header.h $(SOURCE)/data.c
|
||||
$(CC) $(CFLAGS) -c $(SOURCE)/data.c
|
||||
|
@ -106,3 +107,5 @@ label.$(SUF) : data.h back.h $(SRC_DIR)/mach.h $(SOURCE)/label.c
|
|||
common.$(SUF) : data.h back.h $(SRC_DIR)/mach.h $(SOURCE)/common.c
|
||||
$(CC) $(CFLAGS) -c $(SOURCE)/common.c
|
||||
|
||||
dbsym.$(SUF) : data.h back.h $(SRC_DIR)/mach.h $(SOURCE)/dbsym.c
|
||||
$(CC) $(CFLAGS) -c $(SOURCE)/dbsym.c
|
||||
|
|
|
@ -45,6 +45,7 @@ int isdef;
|
|||
register struct Hashitem *ip;
|
||||
register int h;
|
||||
|
||||
if (isdef != FORCE_DEF) {
|
||||
if ( index_symbol_table != -1 ) {
|
||||
s = symbol_table + index_symbol_table;
|
||||
if ( sym == s->on_foff + string_area) {
|
||||
|
@ -71,11 +72,14 @@ int isdef;
|
|||
return ip->hs_nami;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( nname >= size_symbol)
|
||||
mem_symbol_hash();
|
||||
|
||||
s = symbol_table + nname;
|
||||
|
||||
if (isdef != FORCE_DEF) {
|
||||
ip = Hashitems + nname + 1; /* skip the first entry */
|
||||
|
||||
if (isdef == REFERENCE) {
|
||||
|
@ -90,6 +94,7 @@ int isdef;
|
|||
ip->hs_nami = nname;
|
||||
ip->hs_next = Hashtab[h];
|
||||
Hashtab[h] = ip - Hashitems;
|
||||
}
|
||||
|
||||
if ( sym == string)
|
||||
string += string_lengte;
|
||||
|
|
|
@ -11,14 +11,14 @@ ASLIST = back.h bottom.c bss.c con1.c con2.c con4.c \
|
|||
do_close.c do_open.c end_back.c gen1.c gen2.c gen4.c header.h \
|
||||
init_back.c reloc1.c reloc2.c reloc4.c rom1.c rom2.c rom4.c \
|
||||
set_global.c set_local.c switchseg.c symboldef.c text1.c \
|
||||
text2.c text4.c
|
||||
text2.c text4.c dbsym.c
|
||||
|
||||
OBJLIST = back.h con2.c con4.c data.c data.h do_close.c do_open.c \
|
||||
end_back.c extnd.c gen1.c gen2.c gen4.c hash.h header.h \
|
||||
init_back.c label.c memory.c misc.c output.c \
|
||||
reloc1.c reloc2.c reloc4.c relocation.c rom2.c rom4.c \
|
||||
set_global.c set_local.c switchseg.c symboldef.c symtable.c \
|
||||
text2.c text4.c common.c
|
||||
text2.c text4.c common.c dbsym.c
|
||||
|
||||
all:
|
||||
|
||||
|
|
|
@ -1,7 +1,26 @@
|
|||
#define CODE_EXPANDER
|
||||
#include <em.h>
|
||||
#include <stb.h>
|
||||
#include <em_mes.h>
|
||||
|
||||
extern int __db_mes, __db_cst, __db_len, __db_type, __db_add;
|
||||
extern char *__db_str;
|
||||
|
||||
C_cst( l)
|
||||
arith l;
|
||||
{
|
||||
if (__db_mes) {
|
||||
if (! __db_cst) __db_type = l;
|
||||
else if (__db_cst == 1) {
|
||||
if (__db_mes == ms_std) {
|
||||
if (__db_type == N_SLINE) {
|
||||
C_db_sline();
|
||||
}
|
||||
B_symd(__db_str, __db_len, __db_type, (int) l);
|
||||
}
|
||||
else __db_add = l;
|
||||
}
|
||||
else B_symbcst(__db_str, __db_len, __db_type, __db_add, l);
|
||||
__db_cst++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
#define CODE_EXPANDER
|
||||
#include <em.h>
|
||||
#include "back.h"
|
||||
|
||||
extern int __db_mes, __db_len, __db_type, __db_add;
|
||||
extern char *__db_str;
|
||||
|
||||
C_dlb( l, val)
|
||||
label l;
|
||||
char *val;
|
||||
arith val;
|
||||
{
|
||||
if (__db_mes) {
|
||||
B_symbstr(__db_str, __db_len, __db_type, __db_add, extnd_dlb(l), val);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
#define CODE_EXPANDER
|
||||
#include <em.h>
|
||||
#include "back.h"
|
||||
|
||||
extern int __db_mes, __db_len, __db_type, __db_add;
|
||||
extern char *__db_str;
|
||||
|
||||
C_dnam( str, val)
|
||||
char *str;
|
||||
arith val;
|
||||
{
|
||||
if (__db_mes) {
|
||||
B_symbstr(__db_str, __db_len, __db_type, __db_add, extnd_dnam(str), val);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
#define CODE_EXPANDER
|
||||
#include <em.h>
|
||||
#include "back.h"
|
||||
|
||||
extern int __db_mes, __db_len, __db_type, __db_add;
|
||||
extern char *__db_str;
|
||||
|
||||
extern int B_procno;
|
||||
|
||||
C_ilb( l)
|
||||
label l;
|
||||
{
|
||||
if (__db_mes) {
|
||||
B_symbstr(__db_str, __db_len, __db_type, __db_add, extnd_ilb(l, B_procno), (arith) 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
#define CODE_EXPANDER
|
||||
#include <em.h>
|
||||
#include <em_mes.h>
|
||||
|
||||
int __db_mes;
|
||||
char *__db_str = 0;
|
||||
int __db_len = 0;
|
||||
int __db_cst = 0;
|
||||
int __db_type;
|
||||
int __db_add;
|
||||
|
||||
C_mes_begin( ms)
|
||||
int ms;
|
||||
{
|
||||
__db_mes = (ms == ms_stb || ms == ms_std) ? ms : 0;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
#define CODE_EXPANDER
|
||||
#include <em.h>
|
||||
|
||||
extern int __db_mes;
|
||||
extern int __db_cst;
|
||||
extern char *__db_str;
|
||||
|
||||
C_mes_end()
|
||||
{
|
||||
if (__db_mes) {
|
||||
__db_mes = 0;
|
||||
__db_cst = 0;
|
||||
__db_str = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,14 @@
|
|||
#define CODE_EXPANDER
|
||||
#include <em.h>
|
||||
#include "back.h"
|
||||
|
||||
extern int __db_mes, __db_len, __db_type, __db_add;
|
||||
extern char *__db_str;
|
||||
|
||||
C_pnam( str)
|
||||
char *str;
|
||||
{
|
||||
if (__db_mes) {
|
||||
B_symbstr(__db_str, __db_len, __db_type, __db_add, extnd_name(str), (arith) 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
#define CODE_EXPANDER
|
||||
#include <em.h>
|
||||
|
||||
extern int __db_mes;
|
||||
extern char *__db_str;
|
||||
extern int __db_len;
|
||||
|
||||
C_scon( str, siz)
|
||||
char *str;
|
||||
arith siz;
|
||||
{
|
||||
if (__db_mes) {
|
||||
__db_str = str;
|
||||
__db_len = siz;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,3 +268,4 @@ C_bss_fcon ==> not_implemented( "C_bss_fcon").
|
|||
C_hol_fcon ==> not_implemented( "C_hol_fcon").
|
||||
C_con_fcon ==> not_implemented( "C_con_fcon").
|
||||
C_exc ==> not_implemented( "C_exc").
|
||||
C_db_sline ==> .
|
||||
|
|
Loading…
Reference in a new issue