[Oberon] FJump and FixLink
Andreas Pirklbauer
andreas_pirklbauer at yahoo.com
Sun Sep 23 17:45:44 CEST 2018
> The RISC5 processor has an addressbus of 24 bits («adr» in RISC5.v = 16 MB possible).
> The PC and branch displacements are on word boundary, they have 22 bits («disp» in RISC5.v)
>
> In short, I would have coded the procedures as follows:
>
> PROCEDURE FixLink*(L: LONGINT);
> VAR L1: LONGINT;
> BEGIN
> WHILE L # 0 DO L1 := code[L] MOD 2000H; FixOne(L); L := L1 END
> END FixLink;
>
> PROCEDURE FixLinkWith(L0, dst: LONGINT); (* used for «UNTIL» *)
> VAR L1: LONGINT;
> BEGIN
> WHILE L0 # 0 DO
> L1 := code[L0] MOD 2000H; fix(L0, dst - L0 - 1); L0 := L1
> END
> END FixLinkWith;
>
Ok. Got it. This makes more sense. But it works only for ORG.maxCode = 8000,
since 2000H = 8196. In my compilers ORG.maxCode usually is 12000 or
even 16000. So with the above approach, I’d end up having to use 4000H
= 16’384, i.e. the next higher power of 2 (for efficiency) anyway..
How about using C22 = 400000H (with FIVE zeros, not four!) = 4’194’304
= 2^22 instead of 2000H? That way, one would be...
a) correct (max displacement = 22 bits), and
b) “safe” even for all potential values of ORG.maxCode
up 4’194’304 = 4M words = 16MB RAM.
once and for good?
-ap
More information about the Oberon
mailing list