[Oberon] RISC emulator and floating-point

Jan Verhoeven jan at verhoeven272.nl
Tue Mar 25 16:04:30 CET 2014


Paul Reed wrote:
> There's also something wrong with Texts.WriteInt, trying to print
> 80000000H results in a trap.
> Yes that's definitely weird, probably a consequence of the circuitous
> cross-compilation route (via my own RISC VM) I used to create the image.
> I will look at this further and let you know in due course.  Sorry for any
> inconvenience and thanks for the feedback!


Is there really something wrong with the Texts.WriteInt function?

I made the following source:

MODULE wint;

IMPORT Out;

BEGIN
   Out.Int (80000000H, 20);
   Out.Ln
END wint.

and then compiled it with obc:

jan at nitrogen ~/Oberon/source$ obc -o wint wint.m
"wint.m", line 6: warning -- the integer value 2147483648 does not fit in
type INTEGER
 >   Out.Int (80000000H, 20);
 >

So, before you start changing the Module. it may be more appropiate to 
check the syntax parser. Oberon generates a trap. But so does obc.

See what Mocka says:

MODULE wintt;

IMPORT InOut;

BEGIN
   InOut.WriteInt (80000000H, 20);
@                 ^
@ Col 19: constant out of range ( > upb )
   InOut.WriteLn
END wintt.

Also Mocka generates an error before the runtime could generate a trap.


-- 
Groetjes

Jan Verhoeven




More information about the Oberon mailing list