[Oberon] ORX.WriteFile

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Wed Nov 13 22:16:28 CET 2019

   > I used a different approach and isolated the additional code to a separate
   > procedure ORG.WriteHexFile. Easy to do as the global 'code' array contains
   > all the data you need.

Just for the record: If one doesn’t want to modify module ORG in this way, one may wonder whether it is possible to refactor ORX.WriteFile in such a way that it doesn’t need its own ‘code’ array, neither globally nor on the stack (which may be a problem on system with tiny memories).

There is. In my own system building tools, ORX.WriteFile now reads an opcode from the .rsc file and immediately outputs it to a .mem file:

    Files.ReadInt(R, codelen); n := 0;
    WHILE n < codelen DO Files.ReadInt(R, data); WriteHex(R1, data); INC(n) END ;    (*write code to .mem file*)

More information about the Oberon mailing list