-// --- 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);
- }
+void ship_ln(const char * ln)
+{
+ // If listing level is <= 0, then don't print anything
+ if (listing <= 0)
+ return;
+
+ if (list_pag)
+ {
+ // Notice bottom of page
+ if (nlines >= pagelen - BOT_MAR)
+ eject();
+
+ // Print title, boilerplate, and subtitle at top of page
+ if (nlines == 0)
+ {
+ pageno++;
+ println("");
+ date_string(datestr, dos_date());
+ time_string(timestr, dos_time());
+ sprintf(buf,
+ "%-40s%-20s Page %-4d %s %s RMAC %01i.%01i.%02i (%s)",
+ title, curfname, pageno, timestr, datestr, MAJOR, MINOR, PATCH,
+ PLATFORM);
+ println(buf);
+ sprintf(buf, "%s", subttl);
+ println(buf);
+ println("");
+ nlines = 4;
+ }
+ }
+
+ println(ln);
+ nlines++;