compiler

Unnamed Compiled Systems Language Project
git clone http://frotz.net/git/compiler.git
Log | Files | Refs

notes.project.oberon.txt (2660B)


      1 
      2 mailing list: http://lists.inf.ethz.ch/pipermail/oberon/
      3 
      4 
      5 sector numbers (from PO.System)
      6 -------------------------------
      7 3. Sector pointers are represented by sector numbers of type INTEGER. Actually,
      8 we use the numbers multiplied by 29. This implies that any single-bit error
      9 leads to a number which is not a multiple of 29, and hence can easily be
     10 detected. Thereby the crucial sector addresses are software parity checked and
     11 are safe (against single-bit errors) even on computers without hardware parity
     12 check. The check is performed by procedures Kernel.GetSector and
     13 Kernel.PutSector.
     14 
     15 
     16 traps (from PO.Application)
     17 ---------------------------
     18 1 array index out of range
     19 2 type guard failure
     20 3 array or string copy overflow
     21 4 access via NIL pointer
     22 5 illegal procedure call
     23 6 integer division by zero
     24 7 assertion violated
     25 
     26 handled by BLR MT
     27 - first word of module table is trap handler entry
     28 - trap number encoded in bits 4:7 of instruction
     29 - trap 0 used for proc New (sort of a syscall mechanism)
     30 
     31 
     32 
     33 
     34 compiler/ORB.Mod registers builtin funcs, procs, types
     35 UML, SBC, ADC, ROR, ADR, LSL, LEN, CHR, ORD, FLT, FLOOR, ODD, ABS,
     36 LED, UNPK, PACK, NEW, ASSERT, EXCL, INCL, DEC, INC,
     37 SET, BOOLEAN, BYTE, CHAR, LONGREAL, REAL, LONGINT, INTEGER
     38 
     39 SYSTEM module setup with:
     40 H, COND, SIZE, ADR, VAL, REG, BIT,
     41 LDREG, LDPSR, COPY, PUT, GET
     42 
     43 LEN(x)             length of array
     44 
     45 SYSTEM module has built-in low-level/unsafe ops
     46 ------------------------------------------------
     47 v (var), x,a,n (expr)
     48 
     49 ADR(v)             INTEGER address of Variable
     50 SIZE(T)            INTEGER size in bytes of Type 
     51 
     52 VAL(T, n)          raw cast n to T if SIZE(n) <= SIZE(T)
     53 ADC(m, n)          add w/ carry C
     54 SBC(m, n)          sub w/ carry C
     55 UML(m, n)          unsigned mul
     56 COND(n)            IF Cond(n) Then... ?  set cc?
     57 
     58 LED(n)             display on LEDs
     59 
     60 BIT(a, n)          BOOLEAN bit n of mem[a]
     61 GET(a, v)          v := mem[a]
     62 PUT(a, x)          mem[a] := x
     63 COPY(src, dst, n)  memcpy(dst, src, n * sizeof(WORD))
     64 
     65 |> maybe split to builtin.* and unsafe.*
     66 
     67 
     68 
     69 core/Display.Mod
     70 ----------------
     71 (*a pattern is an array of bytes; the first is its width (< 32), the second its height, the rest the raster*)
     72 arrow := SYSTEM.ADR($0F0F 0060 0070 0038 001C 000E 0007 8003 C101 E300 7700 3F00 1F00 3F00 7F00 FF00$);
     73 
     74 
     75 joerg.straube on mailing list
     76 --------------------
     77 You can ask the RISC processor to reveal its version with this code
     78 
     79    cpu := SYSTEM.H(2019) MOD 80H;
     80    IF cpu = 53H THEN       (* RISC5: with interrupts + floating-point, 31.8.2018 *)
     81    ELSIF cpu = 54H THEN (* RISC5a: no interrupts, no floating-point, 1.9.2018*)
     82    ELSIF cpu = A0H THEN (* RISC0, 26.12.2013 *)
     83    END;