Delphi-Quellcode:
procedure CvtInt;
{ IN:
EAX: The integer value to be converted to text
ESI: Ptr to the right-hand side of the output buffer: LEA ESI, StrBuf[16]
ECX: Base for conversion: 0 for signed decimal, 10 or 16 for unsigned
EDX: Precision: zero padded minimum field width
OUT:
ESI: Ptr to start of converted text (not start of buffer)
ECX: Length of converted text
}
asm
OR CL,CL
JNZ @CvtLoop
@C1:
OR EAX,EAX
JNS @C2
NEG EAX
CALL @C2
MOV AL,'
-'
INC ECX
DEC ESI
MOV [ESI],AL
RET
@C2: MOV ECX,10
@CvtLoop:
PUSH EDX
PUSH ESI
@D1:
XOR EDX,EDX
DIV ECX
DEC ESI
ADD
DL,'
0'
CMP
DL,'
0'+10
JB @D2
ADD
DL,('
A'-'
0')-10
@D2: MOV [ESI],
DL
OR EAX,EAX
JNE @D1
POP ECX
POP EDX
SUB ECX,ESI
SUB EDX,ECX
JBE @D5
ADD ECX,EDX
MOV AL,'
0'
SUB ESI,EDX
JMP @z
@zloop: MOV [ESI+EDX],AL
@z:
DEC EDX
JNZ @zloop
MOV [ESI],AL
@D5:
end;
////////////////////////////////////////////////////////////////////////////////
// Procedure : IntToHex
// Comment :
function IntToHex(Value: Integer; Digits: Integer):
string;
// FmtStr(Result, '%.*x', [Digits, Value]);
asm
CMP EDX, 32
// Digits < buffer length?
JBE @A1
XOR EDX, EDX
@A1: PUSH ESI
MOV ESI, ESP
SUB ESP, 32
PUSH ECX
// result ptr
MOV ECX, 16
// base 16 EDX = Digits = field width
CALL CvtInt
MOV EDX, ESI
POP EAX
// result ptr
CALL System.@LStrFromPCharLen
ADD ESP, 32
POP ESI
end;
Fehlermeldung:
[/quote]units\MpuTools.pas(339,1) Fatal: Syntax error, "BEGIN" expected but "
ASM" found[quote]
Setze ich vor Zeile 11 das
begin
kommt folgende Fehlermeldungen für die Zeile 58:
[quote]units\MpuTools.pas(386,1) Error: Illegal expression
units\MpuTools.pas(386,10) Fatal: Syntax error, ";" expected but "identifier INTTOHEX" found