home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / alt / sys / pdp8 / 99 < prev    next >
Encoding:
Text File  |  1992-11-22  |  2.3 KB  |  60 lines

  1. Newsgroups: alt.sys.pdp8
  2. Path: sparky!uunet!psinntp!news.columbia.edu!watsun.cc.columbia.edu!lasner
  3. From: lasner@watsun.cc.columbia.edu (Charles Lasner)
  4. Subject: Re: The good old days.
  5. Message-ID: <1992Nov22.194547.3976@news.columbia.edu>
  6. Sender: usenet@news.columbia.edu (The Network News)
  7. Nntp-Posting-Host: watsun.cc.columbia.edu
  8. Reply-To: lasner@watsun.cc.columbia.edu (Charles Lasner)
  9. Organization: Columbia University
  10. References: <1992Nov19.102634.20745@vpnet.chi.il.us> <1992Nov20.042652.18263@news.columbia.edu> <1992Nov22.050516.19990@vpnet.chi.il.us>
  11. Date: Sun, 22 Nov 1992 19:45:47 GMT
  12. Lines: 46
  13.  
  14. In article <1992Nov22.050516.19990@vpnet.chi.il.us> cgordon@vpnet.chi.il.us (gordon hlavenka) writes:
  15. >
  16. >This means you have more?
  17.  
  18. Not too many more for just a CPU per se.
  19.  
  20. Here's one that came up in another newsgroup:
  21.  
  22. Assume that there is a test location CHAR containing an arbitrary ASCII
  23. character.  (If symbolic gets in the way, then assume it's location 0020,
  24. i.e., CHAR=0020.)
  25.  
  26. Starting at 0200, write the shortest piece of code that can prove that the 
  27. contents of CHAR are in fact within the range of printable octal digits, i.e,
  28. are in the range 0060-0071.  Assume the worst, i.e., the contents could be
  29. junk.  The idea is to do something which contains:
  30.  
  31.     *200
  32.  
  33. START,    CLA CLL            /CLEAN UP
  34.     {whatever you need}
  35.     TAD    CHAR        /GET THE POTENTIAL CHARACTER WE ARE TESTING
  36.     {test it somehow}
  37.     JMP    BAD        /JUMP THERE IF NOT AN OCTAL DIGIT
  38. /    COMES HERE IF THE CHARACTER WAS GOOD.
  39.     HLT            /THIS IS PAST THE CHALLENGE
  40.  
  41. BAD,    HLT            /COMES HERE WHEN CHAR AIN'T AN OCTAL DIGIT
  42.  
  43. Literally any 12-bit value might be in CHAR, but we want to weed out the
  44. "good" values as defined.  The idea is to write the MINIMUM amount of code
  45. to check for the good vs. the bad (and the ugly).  You supply the stuff that
  46. belongs in place of the stuff inside of {} in both places.
  47.  
  48. Note: the AC is allowed to be "dirty" when you get to BAD.
  49.  
  50. When the CHAR is acceptable, it falls through for more processing, etc, so I
  51. have merely placed a HLT there.  Similarly, the "bad" values, having been
  52. isolated can be further processed at BAD, so I have merely placed a HLT there
  53. as well.  (Hint: the AC=0000 through 0007 depending on whether the original
  54. CHAR value was "0" through "7".)
  55.  
  56. On an scale of 1-10, this problem has a difficulty rating of 6.
  57.  
  58. cjl
  59.  
  60.