[Oberon] FPGA - Little Endian & Bit numbering

Tomas Kral thomas.kral at email.cz
Fri Sep 22 18:36:09 CEST 2017

On Fri, 22 Sep 2017 15:46:27 +0200
Jörg <joerg.straube at iaeth.ch> wrote:

> With the following code you can find out, whether the Oberon compiler
> and the CPU uses "LSB 0" or "MSB 0".
>   IF ORD({0}) = 1 THEN Out.String("LSB 0") ELSE Out.String("MSB 0")
>   END;

On my machine gives `LSB 0' 

> The bad thing is, this code MIGHT generate different results on
> different machines, as ORD is not well defined. Principally "ORD"
> should be in MODULE SYSTEM as it's implementation specific, e.g.
> ORD("A") is not defined at all. Almost everybody assumes it's the
> ASCII value 65 but it could also return EBCDIC value 193, but this is
> off-topic. It might be to your surprise, but it will turn out that
> most Oberon implementations use "LSB 0"

This brings another question what is the real difference between
[1] SYSTEM.VAL(INTEGER, {0}), and
[2] ORD({0}),
as both works on my system.

In the code I use the former [1], I thought ORD primarily as opposite of
CHR, but above extends its meaning, also platform dependent.

> Most probably you played with bitmaps and found out that the bit 0 is
> the left most bit on the screen. If you want to move a pixel to the
> RIGHT on the screen, you have to use LSL() (logical shift LEFT).

That's precise, I did. Also I was slightly confused because WriteBin
procedure prints in reverse order. 

Tomas Kral <thomas.kral at email.cz>

More information about the Oberon mailing list