[b]type[/b]
TForm1 = [b]class[/b](TForm)
Button1: TButton;
[b]procedure[/b] Button1Click(Sender: TObject);
[b]private[/b]
[color=#000080]{ Private-Deklarationen }[/color]
FpFrom : PChar;
FpTo : PChar;
FsBufIN : [b]string[/b];
FsBufOUT : [b]string[/b];
[b]public[/b]
[color=#000080]{ Public-Deklarationen }[/color]
[b]procedure[/b] ReplaceGreaterThan;
[b]end[/b];
[b]var[/b]
Form1: TForm1;
[b]implementation[/b]
[color=#000080]{$R *.DFM}[/color]
[b]procedure[/b] TForm1.Button1Click(Sender: TObject);
[b]var[/b]
fsIN : TFileStream;
[b]begin[/b]
fsIN := TFileStream.Create('C:\MeineDatei.xml',fmOpenRead [b]or[/b] fmShareDenyWrite);
[b]try[/b]
FsBufIN := StringOfChar(#00,fsIN.Size);
FsBufOUT := StringOfChar(#00,fsIN.Size * 2);
fsIN.Read(FsBufIN[1],fsIN.Size);
[b]finally[/b]
FreeAndNil(fsIN);
[b]end[/b];
FpFrom := @FsBufIN[1];
FpTo := @FsBufOUT[1];
ReplaceGreaterThan;
[b]end[/b];
[b]procedure[/b] TForm1.ReplaceGreaterThan;
[b]
asm[/b]
@@Start:
[color=#000080]// Register sichern[/color]
push EDI
push ESI
push ESP
push EBP
push EBX
[color=#000080]// Bufferadressen laden[/color]
mov ESI,self
mov EDI,self
mov ESI,[ESI].FpFrom
mov EDI,[EDI].FpTo
[color=#000080]// Sicherstellen, das Adressen hochgezählt werden[/color]
cld
@@mainloop:
[color=#000080]// Quelle nach Ziel kopieren[/color]
mov AL,[ESI]
movsb
[color=#000080]// Zeilenende erreicht?[/color]
cmp AL,$0D
[color=#000080]// Ja, fertig[/color]
jz @@exit
[color=#000080]// Zu ergänzendes Zeichen?[/color]
cmp AL,'>'
[color=#000080]// Nein, nächstes[/color]
jnz @@mainloop
[color=#000080]// sonst #13#10 in den Zielbuffer[/color]
mov AL,$0D
mov [EDI],AL
inc EDI
mov AL,$0A
mov [EDI],AL
inc EDI
[color=#000080]// weiter[/color]
jmp @@mainloop
@@exit:
[color=#000080]// Zeilenende vervollständigen[/color]
mov AL,$0A
mov [EDI],AL
[color=#000080]// Registerinhalte zurückholen[/color]
pop EBX
pop EBP
pop ESP
pop ESI
pop EDI
[b]end[/b];