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

⟦0148aa481⟧ TextFile

    Length: 2590 (0xa1e)
    Types: TextFile
    Notes: UNIX file
    Names: »pop.c«

Derivation

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

TextFile

/*
 * @(#)pop.c	1.1 15:35:15 4/6/85
 *
 * scrblk
 *
 * functions to provide ease of use of the block window i/o system
 */

#include <sys/types.h>
#include	<windows.h>


/*
 * bputattr
 *
 * puts an attribute at the desired locations in the block that will be
 * written to the window.
 *
 */

bputattr (blkbuff, blksize, ulhc_row, ulhc_col, rows, cols, attr)
W2B	*blkbuff;	/* the window block buffer - chars in low bytes,
			   attributes in high bytes */
W2B	blksize;	/* number of rows in high byte, cols in low */
int	ulhc_row;	/* row of upper left hand corner to start with */
int	ulhc_col;	/* col of upper left hand corner to start with */
int	rows;		/* number of rows to put the attribute in */
int	cols;		/* number of cols to put the attribute in */
UINT8	attr;		/* attribute to put */
{
	W2B	*buffptr;
	int	i;

	buffptr = blkbuff + ulhc_row * blksize.bytes.low +
		  ulhc_col;
	while (rows--)
	{
		for (i = 0; i < cols; i++)
			(buffptr + i)->bytes.high = attr;
		buffptr += blksize.bytes.low;
	}
}


/*
 * bputc
 *
 * puts a character at the desired locations in the block that will be
 * written to the window.
 *
 */

bputc (blkbuff, blksize, ulhc_row, ulhc_col, rows, cols, c)
W2B	*blkbuff;	/* the window block buffer - chars in low bytes,
			   attributes in high bytes */
W2B	blksize;	/* number of rows in high byte, cols in low */
int	ulhc_row;	/* row of upper left hand corner to start with */
int	ulhc_col;	/* col of upper left hand corner to start with */
int	rows;		/* number of rows to put the attribute in */
int	cols;		/* number of cols to put the attribute in */
UINT8	c;		/* character to put */
{
	W2B	*buffptr;
	int	i;

	buffptr = blkbuff + ulhc_row * blksize.bytes.low +
		  ulhc_col;
	while (rows--)
	{
		for (i = 0; i < cols; i++)
			(buffptr + i)->bytes.low = c;
		buffptr += blksize.bytes.low;
	}
}



/*
 * bputstr
 *
 * puts a string at the desired location in the block that will be
 * written to the window. The string will be truncated if it goes
 * outside of the block boundary - no wrapping will be done.
 *
 */

bputstr (blkbuff, blksize, ulhc_row, ulhc_col, str)
W2B	*blkbuff;	/* the window block buffer - chars in low bytes,
			   attributes in high bytes */
W2B	blksize;	/* number of rows in high byte, cols in low */
int	ulhc_row;	/* row of upper left hand corner to start with */
int	ulhc_col;	/* col of upper left hand corner to start with */
UINT8	*str;		/* string to put */
{
	W2B	*buffptr;

	buffptr = blkbuff + ulhc_row * blksize.bytes.low +
		  ulhc_col;
	while (*str && ulhc_col++ < blksize.bytes.low)
		(buffptr++)->bytes.low = *str++;
}