+ extended test tasm20.pp with a function, that returns a shortstring (in that

particular case, it is allocated a @Result variable)

git-svn-id: trunk@38248 -
This commit is contained in:
nickysn 2018-02-16 15:02:06 +00:00
parent f1b6be2d74
commit 1a57391e55

View File

@ -2,8 +2,35 @@
{$IFDEF FPC}
{$MODE TP}
{$ELSE}
{$DEFINE FPC_MM_LARGE}
{$ENDIF FPC}
{$IFDEF FPC_MM_TINY}
{$DEFINE NEAR_CODE}
{$DEFINE NEAR_DATA}
{$ENDIF}
{$IFDEF FPC_MM_SMALL}
{$DEFINE NEAR_CODE}
{$DEFINE NEAR_DATA}
{$ENDIF}
{$IFDEF FPC_MM_MEDIUM}
{$DEFINE FAR_CODE}
{$DEFINE NEAR_DATA}
{$ENDIF}
{$IFDEF FPC_MM_COMPACT}
{$DEFINE NEAR_CODE}
{$DEFINE FAR_DATA}
{$ENDIF}
{$IFDEF FPC_MM_LARGE}
{$DEFINE FAR_CODE}
{$DEFINE FAR_DATA}
{$ENDIF}
{$IFDEF FPC_MM_HUGE}
{$DEFINE FAR_CODE}
{$DEFINE FAR_DATA}
{$ENDIF}
program tasm20;
{$S-}
@ -17,6 +44,7 @@ var
{$ifdef FPC}
res3: int64;
{$endif FPC}
res4: string;
expect_sp: word;
actual_sp: word;
@ -49,6 +77,35 @@ asm
end;
{$endif FPC}
function myfunc4: string; assembler;
asm
mov actual_sp, sp
cld
{$IFDEF FAR_DATA}
les di, @Result
{$ELSE}
mov di, @Result
push ds
pop es
{$ENDIF}
mov al, 7 { string length }
stosb
mov al, 'T'
stosb
mov al, 'r'
stosb
mov al, 'a'
stosb
mov al, 'l'
stosb
mov al, 'a'
stosb
mov al, 'l'
stosb
mov al, 'a'
stosb
end;
procedure Error;
begin
Writeln('Error!');
@ -68,5 +125,8 @@ begin
if (res3 <> $123456789ABCDEF0) or (expect_sp <> actual_sp) then
Error;
{$endif FPC}
res4 := myfunc4;
if (res4 <> 'Tralala') and ((expect_sp - actual_sp) <> (2 + SizeOf(Pointer))) then
Error;
Writeln('Ok!');
end.