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

⟦686682dab⟧ TextFile

    Length: 1162 (0x48a)
    Types: TextFile
    Notes: UNIX file
    Names: »subr.c«

Derivation

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

TextFile



#include	"../h/rico.h"
#include	"../h/machine.h"
#include	"../h/display.h"
#include	"../h/subr.h"


char		texttab[MAXLINE];
struct scanline	scantab[YMAX];

slecompute()
{
	register int	y;
	
	for(y=0; y<MAXLINE; y++)
		texttab[y] = (ERASED | SCROLLABLE);
	for(y=0; y<YMAX; y++){
		scantab[y].sc_nword = 0;
		scantab[y].sc_off = 0;
	}
}

slcompute( li)
uint	li;
{
	uint	y,
		ylim;

	if ((li)
	and (li < MAXLINE)
	and (not (texttab[li]&SCROLLABLE))) {
		y = li * YSCROLL;
		ylim = y + YSCROLL;
		for (; y<ylim; ++y)
			scompute( y);
		texttab[li] |= SCROLLABLE;
	}
}


scompute( y)
uint	y;
{
	uint	*p,
		*ep,
		*q,
		*eq;

	if (y < YSPLIT) {
		p = (uint *)SEG0 + y*WPERSL;
		q = (uint *)SEG0 + (y-YSCROLL)*WPERSL;
	}
	else if (y-YSCROLL >= YSPLIT) {
		p = (uint *)SEG1 + (y-YSPLIT)*WPERSL;
		q = p - YSCROLL * WPERSL;
	}
	else {
		p = (uint *)SEG1 + (y - YSPLIT)*WPERSL;
		q = (uint *)SEG0 + (y-YSCROLL)*WPERSL;
	}
	ep = p + WPERSL;
	eq = q + WPERSL;
	loop {
		if (*p != *q)
			break;
		if (++p == ep) {
			scantab[y].sc_nword = 0;
			return;
		}
		++q;
	}
	scantab[y].sc_off = p - ep + WPERSL;
	while (*--ep == *--eq)
		;
	++ep;
	scantab[y].sc_nword = ep - p;
}