🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #10195

clear screen in 280 bytes?

#10195
From: Brian Moffet
Date: Wed, 02 Nov 1988 17:44
58 lines
1766 bytes
I thought that I would see how small I could make a clear screen
program from lattice C 4.01 (or so.)  I actually got it down to
280 bytes or so.  The program is listed below.   For those of you
who do not have Lattice C, the <proto/..> include files include
information which is the offset from the lib base for the appropriate
function call (ExecBase + ###  is a ptr to OpenLibrary etc...)

I'm curious.  I seem to recall the REZ command (or similar) provided
by Workbench 1.3 requires the program to be pure.   What exactly
does this mean.  Does the clear program below qualify?

-=-=-=-=-=-=- 8< ( (<-scissors) snip here ) -=-=-=-=-=-=-=-

/*
 *	Brian Moffet
 *	11-01-88
 *
 *	test to see how small I could make a clear screen.
 *
 *	compile with:
 *		lc -v -adbc cls.c
 *	link with:
 *		blink from cls.o to cls
 *
 *	size is about 280 bytes.
 */

#include <exec/types.h>
#include <libraries/dos.h>
#include <proto/dos.h>
#include <proto/exec.h>

struct DosLibrary *DOSBase;

void
_main()
{
	register long F;

	DOSBase = OpenLibrary( "dos.library", 0 );
	if( DOSBase != NULL )
	{
		F = Open( "*", MODE_OLDFILE );
		if( F != -1 )
		{
			Write( F, "\f", 1 );
			Close( F );
		}
		CloseLibrary( DOSBase );
	}
}

-- 
Brian Moffet			{uunet,decvax!microsoft,ucscc}!sco!brianm
 -or-				...sco!alar!brian
"Evil Geniuses for a better tomoorow!"  My fish and company have policies.
					I have opinions.
Technical Details
Message-ID: <1623@scolex>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!sco!brianm

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!sco!brianm
From: brianm@sco.COM (Brian Moffet)
Newsgroups: comp.sys.amiga.tech
Subject: clear screen in 280 bytes?
Keywords: See how small I could make a C program
Message-ID: <1623@scolex>
Date: 2 Nov 88 17:44:36 GMT
Organization: The Santa Cruz Operation, Inc.
Lines: 58