<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi,</p>
<p>A much more deterministic version would do it as this:</p>
<p>function HiInteger(value: LongInt): LongInt; nostackframe;
assembler;<br>
asm<br>
mov r0, r0, asr #16<br>
end;</p>
<p>If you do it with an inline ASM block and without stackframes it
becomes much harder to predict how you need to address variables
by name<br>
</p>
<p>Best Regards,<br>
Jeppe<br>
</p>
<div class="moz-cite-prefix">On 3/29/23 15:47, Paul Renaud via
fpc-devel wrote:<br>
</div>
<blockquote type="cite"
cite="mid:1078002090.2355037.1680097673909@mail.yahoo.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div class="ydp648f2fa9yahoo-style-wrap"
style="font-family:Helvetica Neue, Helvetica, Arial,
sans-serif;font-size:16px;">
<div>
<div dir="ltr" data-setdir="false">Hello, I've been having a
problem getting some code to compile. I've gone through the
documentation, but</div>
<div dir="ltr" data-setdir="false">there isn't any specific
info for the arm version. This is a simplified version <br>
</div>
<div dir="ltr" data-setdir="false"><br>
</div>
<div dir="ltr" data-setdir="false">
<div>Program Test;<br>
<br>
Function HiInteger( Value: LongInt ): LongInt;<br>
Begin<br>
Asm<br>
LdR R0, Value<br>
Mov R1, R0, ASR #16<br>
StR R1, @Result (* This line generates an
error *)<br>
End [ 'R0', 'R1' ]; <br>
End;<br>
<br>
Begin<br>
End. <br>
<br>
<div>Free Pascal version 3.2.2 for arm</div>
<div><br>
</div>
<div dir="ltr" data-setdir="false">Thanks for any help in
advance.</div>
<div dir="ltr" data-setdir="false">Paul.<br>
</div>
</div>
<div><br>
</div>
</div>
</div>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
fpc-devel maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
</blockquote>
</body>
</html>