🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #10950

Re: Any use for Branch if Even/Odd ?

#10950
From: Don Stokes
Date: Tue, 15 Dec 1992 07:18
42 lines
2207 bytes
andy@SAIL.Stanford.EDU (Andy Freeman) writes:
> In article <id.08RV.WYB@ferranti.com> peter@ferranti.com (peter da silva) writes:
> >Close. As I recall, DEC is very fond of using even/odd for true/false values,
> >and the VMS interface definition has a lot of even/odd status returns, so it's
> >likely these instructions are to make it run VMS real good.
> 
> Does anyone know why they preferred even/odd to >=0/<0?  Sometimes one
> has to test the sign bit, so why not use it whenever one can use any
> bit to split things into two classes?

VMS's error codes allow the severity to be encoded into the bottom three
bits of the code; 0=warning, 1=success, 2=error, 3=informational & 4=fatal.
(5,6 & 7 are unused).  In general, the low bit indicates whether something
worked or didn't.  This contrasts to other systems where you have one code
that means it worked, and umpteen which say it didn't.

The VAX architecture includes a couple of instructions that make the low
bit test.  These are:

	BLBC <src>, <branch-displacement>	Branch on low bit clear
	BLBS <src>, <branch-displacement>	Branch on low bit set

They're rather attractive to use, since the test and branch are in the 
same instruction.  Typical usage is:

	calls #0, routine
	blbc r0, error
or:
	calls #0, routine
	blbs 1$
	pushl R0
	calls #1, SYS$EXIT
    1$:

The latter is common due to the byte sized byte-relative branch
displacements that the VAX architecture is cursed with.  Shades of 6502...
(and the 6502 had smaller instructions to jump over).

--
Don Stokes, ZL2TNM (DS555)                        don@zl2tnm.gen.nz (home)
Network Manager, Computing Services Centre            don@vuw.ac.nz (work)
Victoria University of Wellington, New Zealand              +64-4-495-5052
Technical Details
Message-ID: <14666349@zl2tnm.gen.nz>
Path: arc1-ca.pugleaf.net!sparky!uunet!comp.vuw.ac.nz!zl2tnm!toyunix!don
References: <1992Dec14.203631.16388@CSD-NewsHost.Stanford.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!comp.vuw.ac.nz!zl2tnm!toyunix!don
Newsgroups: comp.arch
Subject: Re: Any use for Branch if Even/Odd ?
Message-ID: <14666349@zl2tnm.gen.nz>
From: don@zl2tnm.gen.nz (Don Stokes)
Date: 15 Dec 92 07:18:40 GMT
Sender: news@zl2tnm.gen.nz (GNEWS Version 2.0 news poster.)
References: <1992Dec14.203631.16388@CSD-NewsHost.Stanford.EDU>
Distribution: world
Organization: The Wolery
Lines: 42