[Oberon] System-V - Frame Clipping

Jörg Straube joerg.straube at iaeth.ch
Mon Mar 4 18:51:28 CET 2019


Tomas

The mask you were referring to was introduced by me.
While porting Walker.Mod (aka Sisiphus) I detected that the original CopyPattern had the restriction of width<32.
But I needed width=32 for the Walker pattern.
The restriction width<32 was there, because ASR() copies over the MSB while shifting right (correct sign extension).

If the MSB of a pattern is set, ASR copies that bit over while shifting, resulting in an unwanted line on the display.

In ASR shifting by -x is equivalent to shifting by 32-x.
To get rid of this unwanted line I use a mask. If I shift the pattern by -26 bits and MSB is set, the result is this
   111111pat
To get rid of these unwanted six 1s, I have to create a mask that looks like this
    000000111111111111
6 zeros and 26 ones.

There are different ways to produce such a mask:
ASR(7FFFFFFF, 31-x) or
ASR({0..30}, 31-x) or
-LSL({0..31}, x)

Jörg

> Am 04.03.2019 um 15:39 schrieb Tomas Kral <thomas.kral at email.cz>:
> 
> On Mon, 4 Mar 2019 11:28:31 +0100
> Andreas Pirklbauer <andreas_pirklbauer at yahoo.com> wrote:
> 
>> mask := SYSTEM.VAL(SET, ASR(7FFFFFFFH, 31-x));
> 
> Hi Andreas,
> 
> Thank you, will toy with your line code.
> 
> The mask above is interesting, not sure I get the idea yet, as I still
> use older version of D.CopyPattern();
> 
> Only thinking about complement 31-x, if could be coded as -x?
> 
> mask := SYSTEM.VAL(SET, ASR(7FFFFFFFH, -(x) ));
> 
> As display buffer is reversed like in the mirror, so
> shift right is visually moving pixels left on the screen and vice versa.
> 
> 7FFFFFFFH = binary all ones, except MSB, are shifted left, x, 31
> complement times.
> 
> As LSL, ASR, ROR, are allowed on SETs, I am thinking of an
> equivalent.
> 
> mask := ASR(-{31}, -(x)); but I do fear is not the same thing.
> 
> Apologies for analysing too much :-)
> 
> Thank you.
> 
> -- 
> Tomas Kral <thomas.kral at email.cz>
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon



More information about the Oberon mailing list