home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / arch / 11653 < prev    next >
Encoding:
Internet Message Format  |  1992-12-15  |  2.1 KB

  1. Path: sparky!uunet!comp.vuw.ac.nz!zl2tnm!toyunix!don
  2. Newsgroups: comp.arch
  3. Subject: Re: Any use for Branch if Even/Odd ?
  4. Message-ID: <14666349@zl2tnm.gen.nz>
  5. From: don@zl2tnm.gen.nz (Don Stokes)
  6. Date: 15 Dec 92 07:18:40 GMT
  7. Sender: news@zl2tnm.gen.nz (GNEWS Version 2.0 news poster.)
  8. References: <1992Dec14.203631.16388@CSD-NewsHost.Stanford.EDU>
  9. Distribution: world
  10. Organization: The Wolery
  11. Lines: 42
  12.  
  13. andy@SAIL.Stanford.EDU (Andy Freeman) writes:
  14. > In article <id.08RV.WYB@ferranti.com> peter@ferranti.com (peter da silva) writes:
  15. > >Close. As I recall, DEC is very fond of using even/odd for true/false values,
  16. > >and the VMS interface definition has a lot of even/odd status returns, so it's
  17. > >likely these instructions are to make it run VMS real good.
  18. > Does anyone know why they preferred even/odd to >=0/<0?  Sometimes one
  19. > has to test the sign bit, so why not use it whenever one can use any
  20. > bit to split things into two classes?
  21.  
  22. VMS's error codes allow the severity to be encoded into the bottom three
  23. bits of the code; 0=warning, 1=success, 2=error, 3=informational & 4=fatal.
  24. (5,6 & 7 are unused).  In general, the low bit indicates whether something
  25. worked or didn't.  This contrasts to other systems where you have one code
  26. that means it worked, and umpteen which say it didn't.
  27.  
  28. The VAX architecture includes a couple of instructions that make the low
  29. bit test.  These are:
  30.  
  31.     BLBC <src>, <branch-displacement>    Branch on low bit clear
  32.     BLBS <src>, <branch-displacement>    Branch on low bit set
  33.  
  34. They're rather attractive to use, since the test and branch are in the 
  35. same instruction.  Typical usage is:
  36.  
  37.     calls #0, routine
  38.     blbc r0, error
  39. or:
  40.     calls #0, routine
  41.     blbs 1$
  42.     pushl R0
  43.     calls #1, SYS$EXIT
  44.     1$:
  45.  
  46. The latter is common due to the byte sized byte-relative branch
  47. displacements that the VAX architecture is cursed with.  Shades of 6502...
  48. (and the 6502 had smaller instructions to jump over).
  49.  
  50. --
  51. Don Stokes, ZL2TNM (DS555)                        don@zl2tnm.gen.nz (home)
  52. Network Manager, Computing Services Centre            don@vuw.ac.nz (work)
  53. Victoria University of Wellington, New Zealand              +64-4-495-5052
  54.