//
// RMAC - Renamed Macro Assembler for all Atari computers
// OBJECT.C - Writing Object Files
-// Copyright (C) 199x Landon Dyer, 2011-2021 Reboot and Friends
+// Copyright (C) 199x Landon Dyer, 2011-2022 Reboot and Friends
// RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
// Source utilised with the kind permission of Landon Dyer
//
static void WriteLOD(void);
static void WriteP56(void);
-
//
// Add entry to symbol table (in ALCYON mode)
// If 'globflag' is 1, make the symbol global
return buf;
}
-
//
// Add an entry to the BSD symbol table
//
z = 0x02000000; // Set equated flag
}
- // If a symbol is both EQUd and flagged as TBD then we let
- // the later take precedence. Otherwise the linker will not even
- // bother trying to relocate the address during link time
+ // If a symbol is both EQUd and flagged as TBD then we let the latter take
+ // precedence. Otherwise the linker will not even bother trying to relocate
+ // the address during link time.
switch (w1 & TDB)
{
return buf;
}
-
//
// Add entry to ELF symbol table; if `globflag' is 1, make the symbol global
//
return buf + 0x10;
}
-
//
// Helper function for ELF output
//
return 40;
}
-
//
// Deposit an entry in the Section Header string table
//
return strSize + 1;
}
-
//
// Deposit a symbol table entry in the ELF Symbol Table
//
return 16;
}
-
//
// Write an object file to the passed in file descriptor
// N.B.: Return value is ignored...
printf("Total : %d bytes\n", sect[TEXT].sloc + sect[DATA].sloc + sect[BSS].sloc);
}
- sy_assign(NULL, NULL); // Assign index numbers to the symbols
+ AssignSymbolNos(NULL, NULL); // Assign index numbers to the symbols
tds = sect[TEXT].sloc + sect[DATA].sloc; // Get size of TEXT and DATA segment
- buf = malloc(0x800000); // Allocate 8MB object file image memory
+ buf = malloc(0x800000); // Allocate 8MB object file image memory
if (buf == NULL)
{
// Point to start of symbol table
p = buf + BSDHDRSIZE + tds + trsize + drsize;
- sy_assign(p, AddBSDSymEntry); // Build symbol and string tables
+ AssignSymbolNos(p, AddBSDSymEntry); // Build symbol and string tables
chptr = buf + 0x10; // Point to sym table size hdr entry
D_long(symsize); // Write the symbol table size
// Assign index numbers to the symbols, get # of symbols (we assume
// that all symbols can potentially be extended, hence the x28)
// (To clarify: 28 bytes is the size of an extended symbol)
- uint32_t symbolMaxSize = sy_assign(NULL, NULL) * 28;
+ uint32_t symbolMaxSize = AssignSymbolNos(NULL, NULL) * 28;
// Alloc memory for header + text + data, symbol and relocation
// information construction.
// Construct symbol table and update the header entry, if necessary
if (prg_flag > 1)
{
- // sy_assign with AddSymEntry updates symsize (stays 0 otherwise)
- sy_assign(buf + HDRSIZE + tds, AddSymEntry);
+ // AssignSymbolNos with AddSymEntry updates symsize (stays 0 otherwise)
+ AssignSymbolNos(buf + HDRSIZE + tds, AddSymEntry);
chptr = buf + 0x0E; // Point to symbol table size entry
D_long(symsize);
extraSyms++;
}
- int numSymbols = sy_assign_ELF(buf + elfSize, AddELFSymEntry);
+ int numSymbols = AssignSymbolNosELF(buf + elfSize, AddELFSymEntry);
elfSize += numSymbols * 0x10;
// String table
if (buf == NULL)
return error("cannot allocate object file memory (in P56/LOD mode)");
-// objImage = buf; // Set global object image pointer
-
memset(buf, 0, 0x600000); // Clear allocated memory
// Iterate through DSP ram buffers
else if (obj_format == RAW)
{
if (!org68k_active)
- {
return error("cannot output absolute binary without a starting address (.org or command line)");
- }
// Alloc memory for text + data construction.
tds = sect[TEXT].sloc + sect[DATA].sloc;
p = buf;
objImage = buf; // Set global object image pointer
- for (i = TEXT; i <= DATA; i++)
+ for(i=TEXT; i<=DATA; i++)
{
- for (cp = sect[i].sfcode; cp != NULL; cp = cp->chnext)
+ for(cp=sect[i].sfcode; cp!=NULL; cp=cp->chnext)
{
memcpy(p, cp->chptr, cp->ch_size);
p += cp->ch_size;
return 0;
}
-
static void WriteLOD(void)
{
D_printf("_START %s 0000 0000 0000 RMAC %01i.%01i.%01i\n\n", firstfname, MAJOR, MINOR, PATCH);
D_printf("\n_END %.4X\n", dsp_orgmap[0].orgadr);
}
-
static void WriteP56(void)
{
for(DSP_ORG * l=&dsp_orgmap[0]; l<dsp_currentorg; l++)
SETBE24(p_buf_len, chunk_size / 3);
}
}
-