Merge Wirth's Display.Mod updates

This commit is contained in:
Peter De Wachter 2019-01-21 22:49:52 +01:00
parent fc1fee0bd5
commit cb4b6764ef

View File

@ -1,4 +1,4 @@
MODULE Display; (*NW 5.11.2013*)
MODULE Display; (*NW 5.11.2013 / 17.1.2019*)
(* Adapted for a customizable framebuffer size -- see git history *)
IMPORT SYSTEM;
@ -52,7 +52,7 @@ MODULE Display; (*NW 5.11.2013*)
END;
INC(a1, Span)
END
ELSE
ELSIF ar > al THEN
left := {(x MOD 32) .. 31}; right := {0 .. ((x+w-1) MOD 32)};
a0 := al;
FOR i := 1 TO h DO
@ -77,11 +77,11 @@ MODULE Display; (*NW 5.11.2013*)
PROCEDURE CopyPattern*(col, patadr, x, y, mode: INTEGER); (*only for modes = paint, invert*)
VAR a0, pwd, i: INTEGER;
w, h, pbt: BYTE; pix: SET;
w, h, pbt: BYTE; pix, mask: SET;
BEGIN SYSTEM.GET(patadr, w); SYSTEM.GET(patadr+1, h); INC(patadr, 2);
a0 := base + (x DIV 32)*4 + y*Span;
a0 := base + (x DIV 32)*4 + y*Span; x := x MOD 32; mask := SYSTEM.VAL(SET, ASR(7FFFFFFFH, 31-x));
FOR i := 1 TO h DO
(*build pattern line; w < 32*)
(*build pattern line; w <= 32*)
SYSTEM.GET(patadr, pbt); INC(patadr); pwd := pbt;
IF w > 8 THEN SYSTEM.GET(patadr, pbt); INC(patadr); pwd := pbt*100H + pwd;
IF w > 16 THEN SYSTEM.GET(patadr, pbt); INC(patadr); pwd := pbt*10000H + pwd;
@ -89,13 +89,13 @@ MODULE Display; (*NW 5.11.2013*)
END
END ;
SYSTEM.GET(a0, pix);
IF mode = invert THEN SYSTEM.PUT(a0, SYSTEM.VAL(SET, LSL(pwd, x MOD 32)) / pix)
ELSE SYSTEM.PUT(a0, SYSTEM.VAL(SET, LSL(pwd, x MOD 32)) + pix)
IF mode = invert THEN SYSTEM.PUT(a0, SYSTEM.VAL(SET, LSL(pwd, x)) / pix)
ELSE SYSTEM.PUT(a0, SYSTEM.VAL(SET, LSL(pwd, x)) + pix)
END ;
IF (x MOD 32) + w > 32 THEN (*spill over*)
IF x + w > 32 THEN (*spill over*)
SYSTEM.GET(a0+4, pix);
IF mode = invert THEN SYSTEM.PUT(a0+4, SYSTEM.VAL(SET, ASR(pwd, -(x MOD 32))) / pix)
ELSE SYSTEM.PUT(a0+4, SYSTEM.VAL(SET, ASR(pwd, -(x MOD 32))) + pix)
IF mode = invert THEN SYSTEM.PUT(a0+4, SYSTEM.VAL(SET, ASR(pwd, -x)) * mask/ pix)
ELSE SYSTEM.PUT(a0+4, SYSTEM.VAL(SET, ASR(pwd, -x)) * mask+ pix)
END
END;
INC(a0, Span)
@ -175,7 +175,7 @@ MODULE Display; (*NW 5.11.2013*)
IF pta0 = pta1 THEN pta0 := patadr+4 END;
INC(a1, Span);
END
ELSE
ELSIF ar > al THEN
left := {(x MOD 32) .. 31}; right := {0 .. ((x+w-1) MOD 32)};
a0 := al;
FOR i := 1 TO h DO