DataMuseum.dk

Presents historical artifacts from the history of:

Commodore CBM-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Commodore CBM-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦fc3fd786d⟧ TextFile

    Length: 1297 (0x511)
    Types: TextFile
    Notes: UNIX file
    Names: »list.c«

Derivation

└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
    └─⟦f4b8d8c84⟧ UNIX V7 Filesystem
        └─ ⟦this⟧ »cmd/as/list.c« 

TextFile

#include "asm.h"

/*
 * Copy a block of source and code to
 * the listing file. If no listing file or
 * the current line is not to be listed
 * just return. Multiple code bytes get
 * put out on extra lines after the source
 * line.
 */
list()
{
	register char *wp;
	register nb;

	if (lflag==0 || lmode==NLIST)
		return;
	slew();
	while (ep < &eb[NERR])
		*ep++ = ' ';
	printf("%.10s", eb);
	if (lmode == SLIST) {
		printf("%31s %5d %s\n", "", line, ib);
		return;
	}
	printf(ADRFMT, laddr);
	if (lmode == ALIST) {
		printf("%24s %5d %s\n", "", line, ib);
		return;
	}
	wp = cb;
	nb = cp - cb;
	list1(wp, nb, 1);
	printf(" %5d %s\n", line, ib);
	while ((nb -= NBOL) > 0) {
		wp += NBOL;
		slew();
		printf("%17s", "");
		list1(wp, nb, 0);
		putchar('\n');
	}
}

list1(wp, nb, f)
register char *wp;
register nb;
{
	register d, i;

	if (nb > NBOL)
		nb = NBOL;
	for (i=0; i<nb; ++i) {
		d = (*wp++)&0377;
		if (lmode == BLIST)
			printf(BFMT, d);
		else {
#if LOHI
			d |= ((*wp++) << 8);
#else
			d = (d<<8) | ((*wp++)&0377);
#endif
			printf(WFMT, d);
			++i;
		}
	}
	if (f) {
		while (i < NBOL) {
			printf(SKIP);
			++i;
		}
	}
}

slew()
{
	if (lop++ >= NLPP) {
		if (page)
			putchar('\f');
		printf("Coherent assembler (%s), page %d\n", CPU, ++page);
		printf("%s\n\n", tb);
		lop = 4;
	}
}