[Oberon] Obstacles when programming in RISC Oberon and proposed patches

Michael Schierl schierlm at gmx.de
Fri May 30 21:27:11 CEST 2014


Am 24.05.2014 22:13, schrieb Michael Schierl:
> in general I like the simplicity of Oberon (and that you usually can
> find the cause of some problems quickly since Oberon itself is written
> all in Oberon and small enough to find what you search) but at some
> places, I think Oberon could be more pleasurable without making it a lot
> more complex. Therefore I prepared a few patches - if you like them,
> feel free to incorporate them, and if not, I can still use them :)

This week I tried to add a few more colors and bigger screen sizes to my
Oberon emulator, and found some more bugs (or at least missing features):

- Mouse pointer wraps at 1024, although the bits in the hardware
"register" support up to 4096x4096.

- Texts.Mod assumes white is color 15, while most of the other code
assumes white is color 1. When having more color support, this results
in some color 15 white and some color 1 white, as well as some color 0
black and some color 14 black (15 XOR 1).

(Trivial) Patch is available at

https://github.com/schierlm/OberonEmulator/blob/master/ProposedPatches/better-display-compatibility.patch


I also noticed that DEC(var, const) seems to have some optimization
issues with large constants, in the sense that it calculates the wrong
value by cutting off the upper 16 bits of the value. INC has the same
issues; on the other hand, copying the constant to a variable makes it
work (probably because it cannot use that optimization in that case).

Noticed here:

https://github.com/schierlm/OberonEmulator/blob/master/Oberon/Display.Mod.Color.txt#L30

Some small test module:

-------------------------------------------
MODULE BugTest;
  IMPORT Texts, Oberon;

  CONST c = 1000000;

  PROCEDURE DebugPrint(i : INTEGER);
  VAR w : Texts.Writer;
  BEGIN
    Texts.OpenWriter(w);
    Texts.WriteInt(w,i, 15);
    Texts.WriteLn(w);
    Texts.Append(Oberon.Log, w.buf);
  END DebugPrint;

  PROCEDURE TestINCDEC*();
    VAR
      i, j : INTEGER;
  BEGIN
    i := 10;
    j := c;
    DebugPrint(i);
    INC(i, c);
    DebugPrint(i);
    INC(i, j);
    DebugPrint(i);
    i := i + c;
    DebugPrint(i);
    DEC(i, c);
    DebugPrint(i);
    DEC(i, j);
    DebugPrint(i);
    i := i - c;
    DebugPrint(i);
  END TestINCDEC;
END BugTest.
-------------------------------------------

Output                | Expected Output
-------------------------------------------
             10       |              10
          16970       |         1000010
        1016970       |         2000010
        2016970       |         3000010
        2000010       |         2000010
        1000010       |         1000010
             10       |              10


No patch from me for that, since it is easy enough to avoid if you know it.


Regards,


Michael



More information about the Oberon mailing list