void append_reloc(ALL_TABLES* tfinal, ALL_TABLES *t1, ALL_TABLES* t2) /* appends t2->reloc[] to tfinal->reloc[], updating the code addresses of the reloc items to the value required in tfinal->reloc[], and editing tfinal->code[] as necessary, */ { int t2_coffset = t1->last_code+1 - t2->first_code; int t2_doffset = t1->last_dseg+1 - t2->first_dseg; int i, yfin; reloc_fields r; for(i = 0; i <= t2->last_reloc; i++) { r = t2->reloc[i]; if(r.r.ref == CODEREF) { r.r.adr += t2_coffset; tfinal->code[r.r.adr].u.y += t2_coffset; } else if(r.r.ref == EXTDSEGREF) { r.r.adr += t2_coffset; if(tfinal->code[r.r.adr].u.y != 0xffff) tfinal->code[r.r.adr].u.y += t2_doffset; } else if(r.r.ref == DSEGREF) { if(r.r.adr == NO_MOD) r.r.tabix = 0x00; else { r.r.adr += t2_coffset; tfinal->code[r.r.adr].u.y += t2_doffset; } } else if(r.r.ref == MARKSTACKREF) { yfin = search_tab(tfinal,t2->tab[t2->code[r.r.adr].u.y].name); r.r.adr += t2_coffset; tfinal->code[r.r.adr].u.y = yfin; } tfinal->last_reloc += 1; tfinal->reloc[tfinal->last_reloc] = r; t2->reloc[i] = r; } }/*end append_reloc */