[Oberon] Standalone BootLoader format

Tomas Kral thomas.kral at email.cz
Thu May 14 22:54:55 CEST 2020


On Thu, 14 May 2020 15:59:32 +0200
JR <joerg.straube at iaeth.ch> wrote:

> Are you sure, Close() is a good place to initialize SB?
> Try to find out, when your added instruction is executed.

This seems even better, one jump only.
  
  entry, fixlist (*not used*): LONGINT;

  PROCEDURE Open*;
    VAR i: INTEGER;
  BEGIN curlev := 0; pc := 0; RH := 0; Put3(2, 7, 0);
    FOR i := 1 TO 7 DO code[pc] := 0H; INC(pc) END
  END Open;

  PROCEDURE Header*(size: LONGINT);
  BEGIN entry := pc; fix(0, pc-1); Put1(Mov, SB, 0, 0)
  END Header;

  PROCEDURE Close*;
  BEGIN Put1(Mov, 0, 0, 0); Put3(0, 7, 0); fix(entry, pc*4)
  END Close;

  PROCEDURE StoreBoot*;
    VAR F: Files.File; R: Files.Rider; i: INTEGER;
  BEGIN i := 0;
    F := Files.New("Risc.bin"); Files.Set(R, F, 0);
    Texts.WriteString(W, "store Risc.bin");
    REPEAT Files.WriteInt(R, code[i]); INC(i)
    UNTIL i = pc; Files.Register(F);
    Texts.WriteString(W, " done.");
    Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf)
  END StoreBoot;

-- 
Tomas Kral <thomas.kral at email.cz>


More information about the Oberon mailing list