[Oberon] RISC emulator

Jan Verhoeven jan at verhoeven272.nl
Tue Mar 25 18:14:23 CET 2014


Paul Onyschuk wrote:
> I'm not that familiar with Oberon yet, but throwing trap, when you try 
> to print value out of range seems sensible? 


Get a copy of obc to get familiar with the language.
http://spivey.oriel.ox.ac.uk/corner/Installing_OBC_release_2.9

obc is a fine compiler, cross platform, without the sidestep to Java or 
C. obc object code is interpreted but at amazing speeds.
See also http://fruttenboel.verhoeven272.nl/obc/index.html

I adapted wint.m:

MODULE wint;

IMPORT Out;

VAR int : INTEGER;

BEGIN
   int := 80000000H - 1;
   Out.String ("7FFFFFFF = ");  Out.Int (int, 20);
   Out.Ln;
   INC (int);
   Out.String ("80000000 = ");  Out.Int (int, 20);
   Out.Ln
END wint.

See it compile, see it run:

jan at nitrogen ~/Oberon/source$ obc -o wint wint.m
jan at nitrogen ~/Oberon/source$ ./wint
7FFFFFFF =           2147483647
80000000 =          -2147483648

A clean compile. And a clean run.


-- 
Groetjes

Jan Verhoeven




More information about the Oberon mailing list