Path: utzoo!mnetor!uunet!husc6!tut.cis.ohio-state.edu!bloom-beacon!gatech!mcnc!decvax!dartvax!eleazar!davidg From: davidg@eleazar.Dartmouth.EDU (David Gelhar) Newsgroups: comp.arch Subject: Re: Sticky overflow (was Shift and Subtract is NOT Multiply) Message-ID: <8421@eleazar.Dartmouth.EDU> Date: 14 Mar 88 00:59:15 GMT References: <7649@pur-ee.UUCP> <7276@sol.ARPA> <718@cresswell.quintus.UUCP> <7486@apple.UUCP> Reply-To: davidg@eleazar.Dartmouth.EDU (David Gelhar) Organization: Dartmouth College, Hanover, NH Lines: 17 The Honeywell 6000 series and relatives (such as DPS 8's), have a 'sticky' overflow bit. Various integer arithmetic instructions set the overflow indicator; it's cleared by the "transfer on overflow" instruction (or by loading the indicators). Another indicator bit (or condition code, if you like to call them that) controls whether or not overflows should cause a fault. Wise-ass programmers sometimes clear the overflow bit with what looks like an infinite loop: TOV * "clear overflow indicator This works great for addition & subtraction, but unfortunately the integer multiply instruction is defined to multiply two one-word quantities together and produce a TWO-word result; you get no indication from the hardware if the result is too large for a single word. This means you're left with a choice between adding a couple of instructions after every multiply to check for overflow (Pascal does this), or having integer overflows on multiplication go undetected (PL/I and C).