🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.sys.pdp8
Article #75

Re: The good old days.

#75
From: Charles Lasner
Date: Sun, 22 Nov 1992 19:45
45 lines
2390 bytes
In article <1992Nov22.050516.19990@vpnet.chi.il.us> cgordon@vpnet.chi.il.us (gordon hlavenka) writes:
>
>This means you have more?

Not too many more for just a CPU per se.

Here's one that came up in another newsgroup:

Assume that there is a test location CHAR containing an arbitrary ASCII
character.  (If symbolic gets in the way, then assume it's location 0020,
i.e., CHAR=0020.)

Starting at 0200, write the shortest piece of code that can prove that the 
contents of CHAR are in fact within the range of printable octal digits, i.e,
are in the range 0060-0071.  Assume the worst, i.e., the contents could be
junk.  The idea is to do something which contains:

	*200

START,	CLA CLL			/CLEAN UP
	{whatever you need}
	TAD	CHAR		/GET THE POTENTIAL CHARACTER WE ARE TESTING
	{test it somehow}
	JMP	BAD		/JUMP THERE IF NOT AN OCTAL DIGIT
/	COMES HERE IF THE CHARACTER WAS GOOD.
	HLT			/THIS IS PAST THE CHALLENGE

BAD,	HLT			/COMES HERE WHEN CHAR AIN'T AN OCTAL DIGIT

Literally any 12-bit value might be in CHAR, but we want to weed out the
"good" values as defined.  The idea is to write the MINIMUM amount of code
to check for the good vs. the bad (and the ugly).  You supply the stuff that
belongs in place of the stuff inside of {} in both places.

Note: the AC is allowed to be "dirty" when you get to BAD.

When the CHAR is acceptable, it falls through for more processing, etc, so I
have merely placed a HLT there.  Similarly, the "bad" values, having been
isolated can be further processed at BAD, so I have merely placed a HLT there
as well.  (Hint: the AC=0000 through 0007 depending on whether the original
CHAR value was "0" through "7".)

On an scale of 1-10, this problem has a difficulty rating of 6.

cjl
Technical Details
Message-ID: <1992Nov22.194547.3976@news.columbia.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!psinntp!news.columbia.edu!watsun.cc.columbia.edu!lasner
References: <1992Nov19.102634.20745@vpnet.chi.il.us> <1992Nov20.042652.18263@news.columbia.edu> <1992Nov22.050516.19990@vpnet.chi.il.us>

Show Full Headers
Complete Article Headers
Newsgroups: alt.sys.pdp8
Path: arc1-ca.pugleaf.net!sparky!uunet!psinntp!news.columbia.edu!watsun.cc.columbia.edu!lasner
From: lasner@watsun.cc.columbia.edu (Charles Lasner)
Subject: Re: The good old days.
Message-ID: <1992Nov22.194547.3976@news.columbia.edu>
Sender: usenet@news.columbia.edu (The Network News)
Nntp-Posting-Host: watsun.cc.columbia.edu
Reply-To: lasner@watsun.cc.columbia.edu (Charles Lasner)
Organization: Columbia University
References: <1992Nov19.102634.20745@vpnet.chi.il.us> <1992Nov20.042652.18263@news.columbia.edu> <1992Nov22.050516.19990@vpnet.chi.il.us>
Date: Sun, 22 Nov 1992 19:45:47 GMT
Lines: 46