-//
-// --- Listing EOL ---------------------------------------------------------------------------------
-//
-
-void listeol(void) {
- CHUNK *ch;
- char *p;
- int col;
- LONG count;
- int fixcount;
-
- DEBUG printf("~list: lsloc=$%lx sloc=$%lx\n", lsloc, sloc);
-
- if(lsloc != sloc) {
- sprintf(buf, "%08lx", lsloc);
- scopy(lnimage+LOC_COL, buf, 8);
- }
-
- if(llineno != curlineno) {
- sprintf(buf, "%5d", llineno);
- scopy(lnimage+LN_COL, buf, 5);
- }
-
- // List bytes only when section stayed the same and the section is not a "no-data" (SBSS)
- // section. An extra annoyance is caused by "ds.b" in a microprocessor mode, which prints
- // out bytes of zero as if they had been deposited with dcb. The fix (kludge) is an extra
- // variable which records the fact that a 'ds.x' directive generated all the data, and it
- // shouldn't be listed
- savsect(); // Update section variables
- if(lcursect == cursect && (sect[lcursect].scattr & SBSS) == 0 && lsloc != sloc && just_bss==0) {
- ch = sect[lcursect].sfcode;
- for(; ch != NULL; ch = ch->chnext)
- if(lsloc >= ch->chloc && lsloc < (ch->chloc + ch->ch_size))
- break;
-
- if(ch == NULL) { // Fatal: Can't find chunk holding code
-
- nochunk:
-
- interror(6); // Can't find generated code in section
- }
-
- p = ch->chptr + (lsloc - ch->chloc);
- col = DATA_COL;
- fixcount = 0;
- for(count = sloc - lsloc; count--; col += 2, ++lsloc) {
- if(col >= DATA_END) { // Ship the line
- col = DATA_COL;
- uc_ln(lnimage);
- ship_ln(lnimage);
- lnfill(lnimage, SRC_COL, SPACE); // Fill with spaces
- sprintf(buf, "%08lx", lsloc);
- scopy(lnimage+LOC_COL, buf, 8);
- }
-
- if(lsloc >= (ch->chloc + ch->ch_size)) {
- if((ch = ch->chnext) == NULL)
- goto nochunk;
- p = ch->chptr;
- }
-
- if(!fixcount)
- fixcount = fixtest(lcursect, lsloc);
-
- if(fixcount) {
- --fixcount;
- strcpy(buf, "xx");
- ++p; // Advance anyway
- } else
- sprintf(buf, "%02x", *p++ & 0xff);
- scopy(lnimage+col, buf, 2);
- }
-
- if(col > DATA_COL) { // Flush partial line
- uc_ln(lnimage);
- ship_ln(lnimage);
- }
- } else {
- uc_ln(lnimage);
- ship_ln(lnimage);
- }
-}