TIP: Click on subject to list as thread! ANSI
echo: delphi
to: BART BROERSMA
from: TIM SCHATTKOWSKY
date: 1997-12-28 19:12:00
subject: Re: ASM in D2

//Hallo Bart, //
am *25. Oktober 1997* um *5:04:06* schriebst Du in der Area *DELPHI*
an *All* eine Mail zum Thema *"ASM in D2"*.
 BB> For example:
 BB> Function UpString(S:String):String; Assembler;
 BB> Asm
 BB>   les di,@Result  {put address of returned string in es:di}
 BB>   ....    ^^^^^^^^ wil give me a compile error: operandsize does not 
 BB>                    match (or soemthing like that...)
this is complete crap. Since D2 uses 32 bit protected mode you have to use 
protected mode code. Since Delphi uses "huge strings" strings have to be 
adressed by Delphi. It should be something like
function DoSomething(S:String):String;
var
  Temp:Pointer;
label
  Action,Done;
begin
     Result:=S;	
     if Length(Result)>0 then
     begin
          Temp:=@Result[1];         // There is a better way to do this, but 
i am not sure how exacltly so i use this
          asm
             push esi               // possibly not needed - see online help 
for ASM  
	       mov esi,offset Result	// Move offset of Result in esi
		 // do processing, example: replace space #32 by #33
Action:      mov al,[esi]
		 inc esi
             cmp al,0
             je  Done
		 cmp al,32
		 jne Action
		 inc al
		 mov -1[esi],al
             jmp Action
Done:		 pop esi
	    end;
	end;
end;
		
 BB> (not even if I use ShortStrings wil it compile, 
Because its Realmode code.
 BB> if that has anything to
 BB> do 
 BB> with it ...)
It has. At lease your method of adressing the String content would work if 
you would use protected mode code.
Bis denne ...
             Tim
--- WP/95 Beta 9 (115.0) Reg.
---------------
* Origin: Der Autor von WinPoint 95 (2:241/1170.29)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.