<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">Robert<div><br></div><div>Of course you can use SYSTEM.BIT the way you used it. However, SYSTEM.BIT is typically used to check HW registers like<div>- was a key pressed on the keyboard or</div><div>- did we receive a frame from network or</div><div>- is the bus ready to send data</div><div>- etc</div><div><br><div dir="ltr">Look at Input.Peek or Kernel.SPI</div><div dir="ltr"><br></div><div dir="ltr">br<br><div>Jörg</div></div><div dir="ltr"><br><blockquote type="cite">Am 05.06.2021 um 08:40 schrieb Jörg <joerg.straube@iaeth.ch>:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><meta http-equiv="content-type" content="text/html; charset=utf-8">Robert<div><br></div><div>In Oberon-7 your procedure could look as follows</div><div><br></div><div>PROCEDURE DisplayIEEE754(x: REAL);</div><div>  VAR s: SET;</div><div>  PROCEDURE Bits(str: ARRAY OF CHAR; s: SET; left, right: INTEGER);</div><div>    BEGIN</div><div>      Out.String(str);</div><div>      FOR i := left TO right BY -1 DO</div><div>        IF i IN s THEN Out.Char(“1“) ELSE Out.Char(“0“) END</div><div>      END</div><div>    END Bits;</div><div>  BEGIN</div><div>    s := SYSTEM.VAL(SET, x);</div><div>    Out.String(“sign is “); IF 31 IN s THEN Out.Ch(“-“) ELSE Out.Ch(“+“) END;</div><div>    Bits(“, expo (binary): “, s, 30, 23)</div><div>    Bits(“ frac (binary): “, s, 22, 0);</div><div>    Out.Ln</div><div>  END DisplayIEEE754;</div><div><br><div dir="ltr">Gruss, Jörg</div><div dir="ltr"><br><blockquote type="cite">Am 05.06.2021 um 01:10 schrieb R. S. Doiel <rsdoiel@gmail.com>:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr">
  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  
  
    <p>That's cool. So what I was thinking of doing is to read the
      address contents of my REAL variable into an INTEGER then use
      SYSTEM.BIT() to report out the sign, the exponent and the
      fraction.  Reading Reals.IntL gave that idea.</p>
    <p><br>
    </p>
    <blockquote>
      <p>(** Convert LONGREAL to hexadecimal. h and l are the high and
        low parts. *)<br>
        PROCEDURE IntL* (x: LONGREAL; VAR h, l: LONGINT);<br>
        BEGIN SYSTEM.GET(SYSTEM.ADR(x) + H, h); SYSTEM.GET(SYSTEM.ADR(x)
        + L, l)<br>
        END IntL;</p>
    </blockquote>
    <p>In the Native Oberon case (Oberon-2) H and L are initialized
      based on system expectation (my interpretation). To better
      understand the SYSTEM module and how it is expected to work I was
      wondering if this made sense in Oberon-7?</p>
    <blockquote>PROCEDURE DisplayIeee754(x : REAL);<br>
        VAR raw : INTEGER;<br>
      BEGIN<br>
        SYSTEM.GET(SYSTEM.ADR(r), raw);<br>
      <br>
        IF SYSTEM.BIT(raw, 31) THEN<br>
          Out.String("sign is -, "); <br>
        ELSE<br>
          Out.String("sign is +, "<br>
        END;<br>
        Out.String(" expo (binary): "); <br>
        FOR i := 31 TO 23 BY -1 DO<br>
          IF SYSTEM.BIT(raw, i) THEN<br>
            Out.Char("1"); <br>
          ELSE<br>
            Out.Char("0"); <br>
          END;<br>
        END;<br>
        Out.String(" frac (binary): "); <br>
        FOR i := 23 TO 0 BY -1 DO<br>
          IF SYSTEM.BIT(raw, i) THEN<br>
            Out.Char("1"); <br>
          ELSE<br>
            Out.Char("0"); <br>
          END;<br>
        END;<br>
        Out.Ln;<br>
      END DisplayIeee754;<br>
    </blockquote>
    <p>Is my understanding correct? If so then I have some compiler
      debugging issues to sort out and that's OK. It's helping me better
      understand language and approach.</p>
    <p>Thanks for the help!<br>
    </p>
    <p>Robert<br>
    </p>
    <div class="moz-cite-prefix">On 6/4/21 3:45 PM, Joerg wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:3837EB67-6EB7-44DF-B799-305FC0AE9B3B@iaeth.ch">
      <pre class="moz-quote-pre" wrap="">Robert

You‘re absolutely right:
SYSTEM.BIT(a, 0) checks the LSB of the word at address a.

I guess for Reals.IntL you don‘t need SYSTEM.BIT.

br
Jörg

</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Am 04.06.2021 um 23:55 schrieb R. S. Doiel <a class="moz-txt-link-rfc2396E" href="mailto:rsdoiel@gmail.com"><rsdoiel@gmail.com></a>:


Hello everyone,

This is probably a bit of a novice question and I apologize but
it has me puzzled.  In the Oberon-7 language report's
SYSTEM.BIT() is described as using "n" to address a specific bit.
On first reading I assumed "n" zero would be the LSB and "n"
thirty one would be MSB where the compiler deals with the local
implementation of bit ordering. Is that the correct reading
of the report?

I was planning on implementing a procedure like Native Oberon's
Reals.IntL() but then started having doubts about my reading of the
Oberon-7 report. Have I made too simple a set of assumptions about
how I should expect SYSTEM.BIT() to work under Oberon-7
implementations?

All the best,

Robert Doiel


--
<a class="moz-txt-link-abbreviated" href="mailto:Oberon@lists.inf.ethz.ch">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems
<a class="moz-txt-link-freetext" href="https://lists.inf.ethz.ch/mailman/listinfo/oberon">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a>
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">--
<a class="moz-txt-link-abbreviated" href="mailto:Oberon@lists.inf.ethz.ch">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems
<a class="moz-txt-link-freetext" href="https://lists.inf.ethz.ch/mailman/listinfo/oberon">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a>
</pre>
    </blockquote>
  

<span>--</span><br><span>Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems</span><br><span>https://lists.inf.ethz.ch/mailman/listinfo/oberon</span><br></div></blockquote></div></div></blockquote></div></div></body></html>