mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-27 17:10:16 +02:00
* ensure that the BSS section for MSX-DOS is correctly initialized to 0
git-svn-id: trunk@45642 -
This commit is contained in:
parent
58eca57feb
commit
4ec76072b4
@ -375,6 +375,7 @@ procedure TInternalLinkerMSXDOS.DefaultLinkScript;
|
|||||||
LinkScript.Concat('ENDEXESECTION');
|
LinkScript.Concat('ENDEXESECTION');
|
||||||
LinkScript.Concat('EXESECTION .bss');
|
LinkScript.Concat('EXESECTION .bss');
|
||||||
LinkScript.Concat(' OBJSECTION _BSS');
|
LinkScript.Concat(' OBJSECTION _BSS');
|
||||||
|
LinkScript.Concat(' OBJSECTION _BSSEND');
|
||||||
LinkScript.Concat(' OBJSECTION _HEAP');
|
LinkScript.Concat(' OBJSECTION _HEAP');
|
||||||
LinkScript.Concat(' OBJSECTION _STACK');
|
LinkScript.Concat(' OBJSECTION _STACK');
|
||||||
LinkScript.Concat('ENDEXESECTION');
|
LinkScript.Concat('ENDEXESECTION');
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
unit si_prc;
|
unit si_prc;
|
||||||
|
|
||||||
{$SMARTLINK OFF}
|
{$SMARTLINK OFF}
|
||||||
|
{$GOTO ON}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
@ -28,9 +29,41 @@ procedure PascalMain; external name 'PASCALMAIN';
|
|||||||
|
|
||||||
{ this *must* always remain the first procedure with code in this unit }
|
{ this *must* always remain the first procedure with code in this unit }
|
||||||
procedure _start; assembler; nostackframe; public name 'start';
|
procedure _start; assembler; nostackframe; public name 'start';
|
||||||
|
label
|
||||||
|
bstart, bend, loop;
|
||||||
asm
|
asm
|
||||||
|
{ first init BSS }
|
||||||
|
ld bc, offset bstart
|
||||||
|
ld hl, offset bend
|
||||||
|
scf
|
||||||
|
ccf
|
||||||
|
sbc hl, bc
|
||||||
|
ld a, 0
|
||||||
|
loop:
|
||||||
|
ld (bc), a
|
||||||
|
inc bc
|
||||||
|
dec hl
|
||||||
|
cp a, l
|
||||||
|
jr NZ, loop
|
||||||
|
cp a, h
|
||||||
|
jr NZ, loop
|
||||||
|
|
||||||
|
{ now we can store the top of the stack }
|
||||||
ld (stktop), sp
|
ld (stktop), sp
|
||||||
jp PASCALMAIN
|
jp PASCALMAIN
|
||||||
|
|
||||||
|
{ When using the SDCC-SDLDZ80 linker, the first object module defines the
|
||||||
|
order of areas (sections). Since this module contains the startup code,
|
||||||
|
it is loaded first, so we define all the sections we use in the proper
|
||||||
|
order. }
|
||||||
|
area '_DATA'
|
||||||
|
area '_BSS'
|
||||||
|
bstart:
|
||||||
|
area '_BSSEND'
|
||||||
|
bend:
|
||||||
|
area '_HEAP'
|
||||||
|
area '_STACK'
|
||||||
|
area '_CODE'
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user