# HG changeset patch # User lost # Date 1232590492 0 # Node ID 10cc87f4b16c9062f7dd0021dfee99b96d8686e1 # Parent 9c6462b3a288b00c6ef8dbd14ada77bb79ca6f7a Added basic raw output module diff -r 9c6462b3a288 -r 10cc87f4b16c src/output.c --- a/src/output.c Thu Jan 22 02:05:30 2009 +0000 +++ b/src/output.c Thu Jan 22 02:14:52 2009 +0000 @@ -100,4 +100,23 @@ void do_output_raw(FILE *of) { + int nskips = 0; // used to output blanks for BSS inline + int sn; + + for (sn = 0; sn < nsects; sn++) + { + if (sectlist[sn].ptr -> flags & SECTION_BSS) + { + // no output for a BSS section + nskips += sectlist[sn].ptr -> codesize; + continue; + } + while (nskips > 0) + { + // the "" is not an error - it turns into a single NUL byte! + writebytes("", 1, 1, of); + nskips--; + } + writebytes(sectlist[sn].ptr -> code, 1, sectlist[sn].ptr -> codesize, of); + } }