use precompiled standard library (not really a linker)
This commit is contained in:
parent
5ce5bc44b8
commit
91cb059f38
8 changed files with 105 additions and 22 deletions
|
|
@ -86,6 +86,12 @@ begin
|
|||
countIns(1);
|
||||
end;
|
||||
|
||||
procedure emitInclude(s:string);
|
||||
begin
|
||||
writeln(outfile, '%include "',s,'"');
|
||||
emitIns('.CPOOL');
|
||||
end;
|
||||
|
||||
procedure emitPrologue;
|
||||
begin
|
||||
writeln(outfile, #9, '.ORG ', startAddress);
|
||||
|
|
@ -95,12 +101,21 @@ begin
|
|||
emitIns2Int('.WORD', defaultHeapSize);
|
||||
emitLabelRaw('_STACK_SZ_PTR');
|
||||
emitIns2Int('.WORD', defaultStackSize);
|
||||
emitIns2Int('.WORD', 0);
|
||||
emitLabelRaw('_MAIN_PTR');
|
||||
emitIns2('.WORD', '_MAIN');
|
||||
emitIns2('LOADCP','_END'); (* end of program is start of heap *)
|
||||
emitIns2('LOADCP', '_MEM_INIT'); (* MEM_INIT initializes heap and sets FP/RP *)
|
||||
(* since RP is not initialized yet, we cannot use CALL
|
||||
and MEM_INIT jumps to _MAIN after it is done *)
|
||||
emitIns('JUMP');
|
||||
emitIns2('BRANCH','@+2'); (* NOP, to make alignment explicit *)
|
||||
emitIns('.CPOOL'); (* header/prologue + 2 constants is 32 bytes *)
|
||||
|
||||
if useStdlib then
|
||||
begin
|
||||
writeln(outfile, '%include "stdlib.lsym"');
|
||||
writeln(outfile, '%incbin "stdlib.lib"');
|
||||
end;
|
||||
end;
|
||||
|
||||
function bytes2words(size:integer):integer;
|
||||
|
|
@ -274,12 +289,6 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure emitInclude(s:string);
|
||||
begin
|
||||
writeln(outfile, '%include "',s,'"');
|
||||
emitIns('.CPOOL');
|
||||
end;
|
||||
|
||||
procedure emitUnitEpilogue;
|
||||
begin
|
||||
emitIns('.CPOOL');
|
||||
|
|
@ -307,10 +316,6 @@ begin
|
|||
else
|
||||
emitInclude('coreloader.lsym');
|
||||
|
||||
emitInclude('float32.lib');
|
||||
emitInclude('runtime.lib');
|
||||
emitInclude('stdlib.lib');
|
||||
|
||||
rewindStringList(usedUnits);
|
||||
while nextStringListItem(usedUnits, unitName) do
|
||||
emitInclude(unitName + UnitSuffix2);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue