[Info-vax] Native compilers
chris
chris-nospam at tridac.net
Tue Mar 8 14:44:05 EST 2022
On 03/08/22 19:08, Simon Clubley wrote:
> On 2022-03-08, abrsvc<dansabrservices at yahoo.com> wrote:
>> Does is make sense to increment R7 at all? It seems that this step should be eliminated as it will be overwritten anyway.
>>
>
> Is it a strange way to set or clear some CPU flags ?
>
In the days when most system and much application code was written in
assembler, programmers played all kinds of tricks with the instruction
set that make no sense unless the reader is intimately conversant
with internal machine architecture. Self modifying code was common,
to save a few bytes of memory, for example. As were sequences to set
or clear condition codes on function return, to flag success or fail.
At one site I worked at, the local idiom was to set the carry flag for
that function, so that the code could do things like:
jsr name;
bcs error;
...
Forget the instruction sequence for that, but makes no sense unless
the internal arch is understood. Unlike Intel, condition codes are
set for many instructions on pdp11 and vax, as is the case for 68K, 6502
and some other machines. Could save a lot of memory back in the day...
Chris
> Of course, what I would be looking at is the surrounding source code
> to see what the other register should _really_ have been instead of R7. :-)
>
> Simon.
>
More information about the Info-vax
mailing list