Skip to content

[Feature Request] ORGIN directive #119

@GSoftwareDevelopment

Description

@GSoftwareDevelopment

It would be nice to be able to specify from the source code level for procedures where they should be compiled. I see my proposal as follows.

  1. via the function/procedure modifier Origin xxxx, where xxxx, would be the address in memory.
procedure myProc(); Origin $2000;
Begin
End;
  1. via a block directive, i.e. {$ORIGIN xxxx} and {$ENDORIGIN}.
{$ORIGIN $2000}
procedure Init();
begin
end;

procedure doSomethin();
begin
end;

procedure Done();
begin
end;
{$ENDORIGIN}

In a block directive, defined functions would get consecutive addresses, counting from the indicated xxxx. A block directive, applied before the definition of UNIT would allow to specify where the library would be compiled. It might not even be necessary to enclose it - that would be sufficient.

{$ORIGIN $2000}
unit Somethin;

interface

implementation

end.

Recursion of {$ORIGN} directives - this is already a matter for discussion :) but I don't hide that it would be welcome :)

It would be possible to compile a part of the routines, e.g. under ROM, where it is also possible to run it - with restrictions, but still. Possibility to build dynamic libraries - of course, after adjusting the rest of the code accordingly.


You could also extend the above idea, not just to code: consider variables and the possibility to allocate them in any space in RAM by defining:

{$VARORIGIN $1000}
  var a:byte;
  b:String[40];
...
{$ENDVAR}

I know that a similar situation can be achieved by using the absolute modifier, but this would give a bit more "slack" in the code, and the possibility of assigning a default value, which can't be done now by using absolute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions