On Feb 7, 2022, at 8:21 PM, Johnny Billquist
<bqt(a)softjar.se> wrote:
On 2022-02-08 01:39, Paul Koning wrote:
...
Re condition codes: it depends a bit on how you
define them. There is an interesting scheme used in the Electrologica machines (X1 from
1958, X8 from 1964). Similar to ARM, they allow essentially all instructions to be
executed conditionally. Unlike ARM, you get to choose which instructions set the
condition flag and whether to set it on zero or negative or something more complicated
that I always forget. Then you can conditionally execute instructions (if flag set, or if
flag clear). You can have intervening instructions that don't touch the flag. For
example:
A=VAR1,P " Load register A with VAR1, remember if it was positive
SUBC(:SUB42) " Call SUB42 to get a value in S
Y,S+VAR2 " Add VAR2 if VAR1 was positive
N,S-VAR3 " but subtract VAR3 from S
The subroutine call saves and restores (by convention, you can avoid it) the flag.
Yeah, conditional execution based on condition codes are pretty nice. I would probably
agree that they are pretty comparable to the condition codes in the PDP-11.
In ARM, yes. There, as far as I remember (which isn't far) condition codes are set by
most instructions, as on the PDP-11. The extra bit of magic Electrologica offered was to
control which instructions touch the condition flag, so you could set it and then do a
whole bunch of stuff on that condition, with operations interspersed that don't check
the condition. The example I just gave is a very simple case, with two instructions
conditionally executed from that one flag setting (with opposite sense); real code may
show longer strings. The conditional execution modifier (the leading Y, or N,) had a
third option: "U," meaning "do the operation including flag setting but
don't actually write the result". So you didn't need separate test
instructions; any instruction could become a test-flavor instruction by being U-modified.
For example "U,RCA(1),P" (rotate A right one bit circularly) is a
non-destructive "test if the contents of A is even.
paul