Skip to content

Commit

Permalink
ORL - Add procedure ORL.DecBin to inspect a prelinked binary file
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaspirklbauer committed Mar 10, 2024
1 parent 0a60b08 commit fb7b027
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 6 deletions.
Binary file modified Documentation/S3RISCinstall.tar.gz
Binary file not shown.
1 change: 1 addition & 0 deletions EOS_news.txt
Expand Up @@ -72,3 +72,4 @@
2023-12-30 ORG - Allow offsets >512K in load/store instuctions generated by ORG.Put2
2024-01-01 ORG - Enforce the rule that RH is always the next free register (top of register stack)
2024-03-01 ORL - Allow executing pre-linked binaries and standalone programs
2024-03-10 ORL - Add procedure ORL.DecBin to inspect a prelinked binary file
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -14,9 +14,9 @@ Features
* Improved import/export, e.g. import any number of modules and in any order
* Simple batch execution facility

**Last release:** 1.3.2024 / Extended-Oberon-1.10
**Last release:** 10.3.2024 / Extended-Oberon-1.11

**Last update:** 1.3.2024
**Last update:** 10.3.2024

The file [**S3RISCinstall.tar.gz**](Documentation/S3RISCinstall.tar.gz) always reflects the *latest* version of Extended Oberon, as described in the file [**EOS_news.txt**](EOS_news.txt).

Expand Down
38 changes: 36 additions & 2 deletions Sources/ORTool.Mod
@@ -1,6 +1,7 @@
MODULE ORTool; (*NW 18.2.2013 / 12.4.2017 / AP 7.8.22 Extended Oberon*)
MODULE ORTool; (*NW 18.2.2013 / 12.4.2017 / AP 10.3.24 Extended Oberon*)
IMPORT SYSTEM, Files, Modules, Texts, Oberon, ORB;
CONST TAB = 09X; (*copied from Input for use as cross development tool*)
AllocAdr = 16; FPrintAdr = 28; ModAdr = 32; FPrint = 12345678H; (*copied from ORL*)
VAR W: Texts.Writer;
mnemo0, mnemo1: ARRAY 16, 4 OF CHAR; (*mnemonics*)
typlev: INTEGER;
Expand Down Expand Up @@ -293,7 +294,40 @@ MODULE ORTool; (*NW 18.2.2013 / 12.4.2017 / AP 7.8.22 Extended Oberon*)
END
END DecMod;

BEGIN Texts.OpenWriter(W); Texts.WriteString(W, "ORTool 18.2.2013 / AP 1.8.22");
PROCEDURE DecBin*; (*decode pre-linked binary file*)
VAR AllocPtr, fprint, pos, num, size, prg, refcnt: INTEGER;
name: ARRAY 32 OF CHAR;
F: Files.File; R: Files.Rider;
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); F := Files.Old(S.s);
IF F # NIL THEN
Files.Set(R, F, FPrintAdr); Files.ReadInt(R, fprint);
IF fprint = FPrint THEN
Files.Set(R, F, AllocAdr); Files.ReadInt(R, AllocPtr); Texts.WriteInt(W, AllocPtr, 7); Texts.WriteLn(W);
Files.Set(R, F, ModAdr); pos := ModAdr;
WHILE ~R.eof & (pos < AllocPtr) DO
Files.ReadString(R, name);
Files.Set(R, F, pos+40); (*num*) Files.ReadInt(R, num);
Files.ReadInt(R, size); (*size*) Files.ReadInt(R, refcnt); (*refcnt*)
Files.Set(R, F, pos+64); (*prg*) Files.ReadInt(R, prg);
IF name[0] # 0X THEN Texts.WriteString(W, " ");
Texts.WriteString(W, name); Texts.WriteInt(W, num, 4); Texts.Write(W, TAB);
Texts.WriteHex(W, pos); Texts.WriteHex(W, prg); Texts.WriteInt(W, refcnt, 4)
ELSE Texts.WriteString(W, "---")
END ;
Texts.WriteLn(W); INC(pos, size); Files.Set(R, F, pos)
END
ELSE Texts.WriteString(W, " input file format error"); Texts.WriteLn(W)
END
ELSE Texts.WriteString(W, " not found"); Texts.WriteLn(W)
END ;
Texts.Append(Oberon.Log, W.buf)
END
END DecBin;

BEGIN Texts.OpenWriter(W); Texts.WriteString(W, "ORTool 18.2.2013 / AP 10.3.24");
Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf);
mnemo0[0] := "MOV";
mnemo0[1] := "LSL";
Expand Down
4 changes: 2 additions & 2 deletions Sources/System.Mod
@@ -1,8 +1,8 @@
MODULE System; (*JG 3.10.90 / NW 12.10.93 / NW 20.6.2016 / AP 1.3.24 Extended Oberon*)
MODULE System; (*JG 3.10.90 / NW 12.10.93 / NW 20.6.2016 / AP 10.3.24 Extended Oberon*)
IMPORT SYSTEM, Kernel, Disk, FileDir, Files, Modules,
Input, Display, Viewers, Fonts, Texts, Oberon, MenuViewers, TextFrames;

CONST Version* = "Extended Oberon System AP 1.3.24";
CONST Version* = "Extended Oberon System AP 10.3.24";
StandardMenu = "System.Close System.Copy System.Grow Edit.Search Edit.Store | System.Expand System.Spread System.Clone";
LogMenu = "Edit.Locate Edit.Search System.Copy System.Grow System.Clear | System.Expand System.Spread System.Clone";

Expand Down

0 comments on commit fb7b027

Please sign in to comment.