BASM = Borland/Codegear/Embarcadero's Built-In Assembler, the Delphi inline assembler
Questions tagged [basm]
50 questions
4
votes
1 answer
How to optimize this Delphi function with SSE2?
I need a hint, how to implement this Delphi function using SSE2 assembly (32 Bit). Other optimizations are welcome too. Maybe one can tell me, what kind of instructions could be used, so I have a starting point for further reading.
Actual:
const…

Steffen Binas
- 1,463
- 20
- 30
3
votes
2 answers
Call Object Method using ASM -- Part 2
This question is based on a previous, but that's just FYI.
I've managed to get it working, however, I've found something that's not clear to me, so if anyone can explain the following behaviour, it would be awesome.
I have the following class:
type
…
user497849
3
votes
1 answer
Call Object Method using ASM
To better explain what I'm trying to accomplish, I'm going to start with something that works.
Say we have a procedure that can call another procedure and pass a string parameter to it:
procedure CallSaySomething(AProc: Pointer; const AValue:…
user497849
3
votes
2 answers
Delphi XE2 assembly
I have the following function that works in Delphi 2006, but under Delphi XE2 it gives either an access violation error or a privileged instruction error when processing RET.
function Q_TrimChar(const S: string; Ch: Char): string;
asm
PUSH …

There is no spoon
- 1,775
- 2
- 22
- 53
3
votes
1 answer
Delphi XE2 64bit: inline asm in GraphicEx
How would this turn out from asm to pure delphi? I cant compile a component that needs GraphicEx, giving me an error in JPG unit that inline assembly isn't suported for 64 bit.
function __ftol: Integer;
var
f: double;
begin
asm
lea eax, f…

hikari
- 3,393
- 1
- 33
- 72
3
votes
4 answers
Delphi: Access violation when putting a string in an editbox?
Well, I am studing some inline assembly in Delphi and the assembly crypto routine is all going great, until I try to parse the ShortString into the Textbox.
The violation I get is as follows:
The full code is here:
procedure…

zeta
- 1,113
- 3
- 15
- 24
3
votes
2 answers
Why this LEA instruction does not compile?
I am porting 32-bit Delphi BASM code to 64-bit FPC (Win64 target OS) and wonder why the next instruction does not compile in 64-bit FPC:
{$IFDEF FPC}
{$ASMMODE INTEL}
{$ENDIF}
procedure DoesNotCompile;
asm
LEA ECX,[ECX + ESI +…

kludg
- 27,213
- 5
- 67
- 118
3
votes
1 answer
Delphi inline assembler and class properties
I am trying to rewrite the TList.IndexOf method in assembler (XE3). Here is my code
function TFastList.IndexOfAsm(Item: Pointer): Integer;
{var
P: PPointer;
begin
P := Pointer(FList);
for Result := 0 to FCount - 1 do
begin
if P^ = Item…

Anton Duzenko
- 2,366
- 1
- 21
- 26
3
votes
2 answers
Translate a code using pointer, to Assembly in Pascal - Delphi
I have this code below, and I want to translate it to ASM, to use in Delphi too.
var
FunctionAddressList: Array of Integer;
type TFunction = function(parameter: Integer): Integer; cdecl;
function Function(parameter: Integer): Integer;
var
…

Toribio
- 3,963
- 3
- 34
- 48
3
votes
1 answer
Why do I get an access violation when porting this assembly code to x64?
I'am using this component http://sourceforge.net/projects/tponguard/
and now I need to compile in 64bit. I'm stuck in this assembly.
It was like this:
push esi
push edi
mov esi, eax //esi = Mem1
mov edi, edx //edi = Mem2
…

user2470881
- 33
- 3
3
votes
1 answer
Assembler array max element search
I need to write asm function in Delphi to search for max array element. So that wat I wrote.
Got few prolbems here.
First - mov ecx, len just dosen't work in right way here. Actually it replaces value in ECX but not with value in len! And if I…

DanilGholtsman
- 2,354
- 4
- 38
- 69
2
votes
2 answers
assembly conversion to basm
I'm trying to convert the CrapWOW Hash from http://www.team5150.com/~andrew/noncryptohashzoo/CrapWow.html to delphi or rather to basm. My asm skills are very limited, but i thought it wouldn't be too hard...
Anyway, with help of some webpages about…

Roman Ganz
- 1,615
- 1
- 20
- 27
2
votes
2 answers
FPC BASM32 MUL bug?
I come across a problem while porting Delphi BASM32 code to FPC:
program MulTest;
{$IFDEF FPC}
{$mode delphi}
{$asmmode intel}
{$ELSE}
{$APPTYPE CONSOLE}
{$ENDIF}
function Mul(A, B: LongWord): LongWord;
asm
MUL …

kludg
- 27,213
- 5
- 67
- 118
2
votes
2 answers
Delphi Assembly Function Returning a Long String
I am trying to learn inline assembly programming in Delphi, and to this end I have found this article highly helpful.
Now I wish to write an assembly function returning a long string, specifically an AnsiString (for simplicity). I have…

Andreas Rejbrand
- 105,602
- 8
- 282
- 384
2
votes
1 answer
Naked 64-bit asm functions in Delphi and FPC
Are FPC's nostackframe and Delphi's .NOFRAME directive exactly equivalent in 64-bit asm functions?
In other words does the next code template
procedure Naked(SomeArg: Integer);{$IFDEF FPC}nostackframe;{$ENDIF}
asm
{$IFNDEF FPC}
…

kludg
- 27,213
- 5
- 67
- 118