[Oberon] Standalone BootLoader format

JR joerg.straube at iaeth.ch
Wed May 13 10:16:40 CEST 2020


Here the code in case you are interested
Jörg

PROCEDURE DecCode*(adr, len: INTEGER);
	(* len is nbr of bytes *)
	VAR data: INTEGER;
	BEGIN
		INC(len, adr);
		WHILE adr < len DO
			SYSTEM.GET(adr, data); Texts.WriteInt(W, adr, 4); Texts.Write(W, 9X); Texts.WriteHex(W, data);
			Texts.Write(W, 9X); opcode(data); Texts.WriteLn(W); INC(adr, 4)
		END;
		Texts.Append(Oberon.Log, W.buf)
	END DecCode;

PROCEDURE DecMod*;
	VAR
		mod: Modules.Module;
		len: INTEGER;
		S: Texts.Scanner;
	BEGIN
		Texts.OpenScanner(S, Oberon.Par.text, Oberon.Par.pos); Texts.Scan(S);
		IF S.class = Texts.Name THEN
			Texts.WriteString(W, "decode "); Texts.WriteString(W, S.s);
			Modules.Load(S.s, mod);
			IF mod = NIL THEN Texts.WriteString(W, " couldn't load"); Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf)
			ELSE
				Texts.WriteLn(W); len := mod.imp - mod.code;
				Texts.WriteString(W, "code"); Texts.WriteInt(W, len DIV 4, 6); Texts.WriteLn(W);
				DecCode(mod.code, len)
			END
		END
	END DecMod;

> Am 13.05.2020 um 10:10 schrieb JR <joerg.straube at iaeth.ch>:
> 
> For this, I have a command ORTool.DecMod that decodes a loaded and fixuped module.
> Jörg
> 
>> Am 13.05.2020 um 10:02 schrieb Andreas Pirklbauer <andreas_pirklbauer at yahoo.com>:
>> 
>> Tomas,
>> 
>> As a side comment: It’s a bit unfortunate indeed that the tool command
>> ORTool.DecObj does not detect instructions that are part of a fixup chain.
>> 
>> An improved version of the decoder tool would not output this:
>> 
>>  5 40000000 MOV R0 R0 0 
>>  6 8D000006 LDW SB R0 6
>>  7 A0D00008 STW R0 SB 8
>> 
>> but something like this:
>> 
>>  5 40000000 MOV R0 R0 0 
>>  6 8D000006 LDW R1 mno 0        ; to be fixed up by module loader to LD RH, MT, mno*4
>>  7 A0D00008 STW R0 SB 8
>> 
>> or similar. See here for such an improved decoder tool:
>> 
>> http://github.com/andreaspirklbauer/Oberon-improved-decoder-tool/tree/master/Sources/FPGAOberon2013/Variant1
>> 
>> -ap
>> 
>> --
>> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
>> https://lists.inf.ethz.ch/mailman/listinfo/oberon
> 
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon



More information about the Oberon mailing list