[Oberon] FPGA - Bitmaps.Mod

Tomas Kral thomas.kral at email.cz
Fri Apr 21 11:45:04 CEST 2017


Hi,

I have made some progress with Bitmaps, and it now supports replace and
invert modes.

Some constants.

CONST
  BufSize = 1024;  linelength = 1024 DIV 8; Height = 768;


I use this Clear* method to initialise a bitmap to vertical stripe
0AAAAAAAAH pattern. It makes visual feedback easier.

Simplified DisplayBlock* procedure for B/W frame.

PROCEDURE DisplayBlock*(B: Bitmap; sx, sy, w, h, dx, dy, mode: INTEGER);
  VAR pw, pd, src, dst: INTEGER;
BEGIN pd := B.depth;
  IF (w > 0) & (h > 0) & (pd = 1) THEN
    pw := B.width DIV 8;
    src := B.base;
    dy := Height-dy-h; (* convert dy to screen coordinate 0,0 =
top,left *) dst := Display.Base + dy * linelength + dx DIV 8;   (* top
left corner *) IF mode = Display.invert THEN
      REPEAT
        DisplayBlock2(src, dst, pw);
        DEC(h);  INC(src, pw);  INC(dst, linelength)
      UNTIL h = 0
    ELSE
      REPEAT
        DisplayBlock0(src, dst, pw);
        DEC(h);  INC(src, pw);  INC(dst, linelength)
      UNTIL h = 0
    END
  END
END DisplayBlock;

Just calls line by line copy procedures depending on mode = replace /
paint (to do) / invert

I copied & modified below code without much understanding, it operates
on Oberon SET {0..31} variables.

left := dst MOD 4; right := w MOD 4;
...
SYSTEM.GET(src, t);  SYSTEM.GET(dst, s);
SYSTEM.PUT(dst, s / (t * {left*8..31} * {0..right*8-1}))
...

I believe
`s / t' is the intersection, but I do not understand this construct
(t * {left*8..31} * {0..right*8-1})
?

So for various screen modes I would generally use:
s / t ... for invert
s + t ... for paint
s - t ... for replace mode?

I tested simple byte copy, but this works only on bitmaps with n*8 (w,h)
dimensions.

(* test src to dst byte copy *)
(*WHILE w # 0 DO   
    SYSTEM.GET(src, ch);
    SYSTEM.PUT(dst, ch);
    INC(src); INC(dst); DEC(w, 8)
  END*)

Many thanks
Tomas


More information about the Oberon mailing list