🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.linux.misc
Article #2107

Re: [OT] Dead DEC Punch card times (was Re: Taking Speedy too seriously)

#2107
From: Lawrence D’Oliveiro
Date: Fri, 06 Nov 2026 20:53
47 lines
3398 bytes
On Fri, 6 Nov 2026 14:30:35 +0100, Carlos E. R. wrote:

> On 2026-11-06 00:17, Lawrence D’Oliveiro wrote:
>>
>> Here’s one trivia question: the decrement-and-branch instruction
>> would fall out of the loop when the count reached -1, not 0 as the
>> equivalent instruction in nearly every other computer architecture
>> did. Why?
>
> Mmm. I don't remember. A flag went up?

It was quite a clever feature, which I think ended up widely
misunderstood. Otherwise more architectures would have copied it.

The reason is, so that if the loop count was zero, you could just
fall out of the loop automatically, without having to do an explicit
test for that case.

Example skeleton loop: (remember, the loop count was only 16 bits):

    move.w «loop-count», dN ; dN = some convenient d-register
    bra loop_bottom
loop_top:
    ... body of loop ...
loop_bottom:
    dbra dN, loop_top
    ... here on loop end ...

Notice this will loop exactly «loop-count» times, even if «loop-count»
is zero.

If you want a 32-bit loop count, it only took a few more instructions:

    move.l «loop-count», dN
    bra loop_bottom
loop_top1:
    swap dN
loop_top2:
    ... body of loop ...
loop_bottom:
    dbra dN, loop_top2
    swap dN
    dbra dN, loop_top1
    ... here on loop end ...

(This is all from memory, it’s been a long while since I wrote any
68000-family assembler.)
Technical Details
Message-ID: <11cleon$2sgsp$3@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <18dee4b6cab427fa$865$2574533$802601b3@news.usenetexpress.com> <ayudnc43iJgfVXr3nZ2dnZfqn_adnZ2d@giganews.com> <11c8mg3$2e89e$2@kst.eternal-september.org> <_ZucnafJTvBFc3r3nZ2dnZfqnPGdnZ2d@giganews.com> <11c8rq9$1e6t$1@gal.iecc.com> <nkqj0vFftq4U8@mid.individual.net> <URVFS.20180$1WK1.4115@fx14.ams4> <nkqpvsFftq4U9@mid.individual.net> <%Y_FS.30812$Gsmc.9148@fx17.ams4> <nks7oaF2rmsU2@mid.individual.net> <20261103155316.609@kylheku.com> <BRedndRyj8uMNnf3nZ2dnZfqnPSdnZ2d@giganews.com> <20261105095148.000026b0@gmail.com> <nl42ntF2rmsU25@mid.individual.net> <20261105121255.00003b4b@gmail.com> <1j6dnU7499aecXH3nZ2dnZfqn_WdnZ2d@giganews.com> <11cirsg$1votj$9@dont-email.me> <nl4afqFaf1bU7@mid.individual.net> <11cj2r4$22bch$7@dont-email.me> <nl633rFl7kmU2@mid.individual.net>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D’Oliveiro <ldo@nz.invalid>
Newsgroups: comp.os.linux.misc,alt.folklore.computers
Subject: Re: [OT] Dead DEC Punch card times (was Re: Taking Speedy too
 seriously)
Date: Fri, 6 Nov 2026 20:53:43 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <11cleon$2sgsp$3@dont-email.me>
References: <18dee4b6cab427fa$865$2574533$802601b3@news.usenetexpress.com>
	<ayudnc43iJgfVXr3nZ2dnZfqn_adnZ2d@giganews.com>
	<11c8mg3$2e89e$2@kst.eternal-september.org>
	<_ZucnafJTvBFc3r3nZ2dnZfqnPGdnZ2d@giganews.com>
	<11c8rq9$1e6t$1@gal.iecc.com> <nkqj0vFftq4U8@mid.individual.net>
	<URVFS.20180$1WK1.4115@fx14.ams4> <nkqpvsFftq4U9@mid.individual.net>
	<%Y_FS.30812$Gsmc.9148@fx17.ams4> <nks7oaF2rmsU2@mid.individual.net>
	<20261103155316.609@kylheku.com>
	<BRedndRyj8uMNnf3nZ2dnZfqnPSdnZ2d@giganews.com>
	<20261105095148.000026b0@gmail.com> <nl42ntF2rmsU25@mid.individual.net>
	<20261105121255.00003b4b@gmail.com>
	<1j6dnU7499aecXH3nZ2dnZfqn_WdnZ2d@giganews.com>
	<11cirsg$1votj$9@dont-email.me> <nl4afqFaf1bU7@mid.individual.net>
	<11cj2r4$22bch$7@dont-email.me> <nl633rFl7kmU2@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 06 Nov 2026 20:53:44 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3031961"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19Cgv0TZkvb1oShlhpjIbcu"; posting-host="805450eec5e4df4938c911987d9875f0"
User-Agent: Pan/0.165 (Kostiantynivka)
Cancel-Lock: sha1:izejD8a0VqeK+5SRCf5VLYddccI= sha256:9QrJzQ9h1NgZVH9V1ufPxm15rRWOlf6bVYVqKYfuVBA=
	sha1:cLePdqpt9Zztslmz2SpQ2xHbuMk= sha256:JpQslYibcJsgPEM+IRwCiElDjlKaxV/+jl7SO4SUefI=