Announcement

Collapse
No announcement yet.

Compiler Magic (globale Code-Label...)

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Compiler Magic (globale Code-Label...)

    <pre><b>label</b>
    TestStart, TestEnde;
    <p>
    <b>procedure</b> Test;
    <b>asm</b>
    TestStart:
    PUSH EAX
    POP EAX
    TestEnde:
    <b>end</b>;
    <p>
    <b>procedure</b> TForm1.Button1Click(Sender: TObject);
    <b>var</b>
    Start: DWORD;
    Ende: DWORD;
    Diff: DWORD;
    <b>begin</b>
    <b>with</b> Memo1.Lines <b>do</b>
    <b>begin</b>
    Clear;
    <b>asm</b>
    MOV Start, OFFSET TestStart
    MOV Ende, OFFSET TestEnde
    MOV Diff, OFFSET TestEnde
    SUB Diff, OFFSET TestStart
    <b>end</b>;
    Add('@Test : ' + IntToHex(DWORD(@Test), 8));
    Add('TestStart: ' + IntToHex(Start, 8));
    Add('TestEnde : ' + IntToHex(Ende, 8));
    Add('<Diff> : ' + IntToHex(Diff, 8));
    <b>end</b>;
    <b>end</b>;<p></pre>
    Kann mir bitte jemand die folgende Ausgabe im Memo erklären!
    <pre><p><i>@Test : 0044FC6C
    TestStart: 0044FBD0
    TestEnde : 0044FB06
    <Diff> : FFFFFF36</i><p></pre>
    irgendwie stimmt da gar nichts...<br>
    Mal davon abgesehen, das der Compiler extreme Schwierigkeiten mit globalen Labels hat, andauernd Exceptions beim Compilieren (in DCCx0.DLL)...

    Gruß Nico

    getestet mit Delphi 5 und Delphi 6, beide mit dem gleichen Problem<br>
    vielleicht weiß ja jemand, warum das so ist -- oder ich bin blind

  • #2
    Hi den D3 Compiler schiesste damit auch ab. Gleiche wei TProcedure(1) ! schiesst ALLE Delphi Compiler ab bis auf die 16 Bit Version.

    eine Alternative:

    <pre>

    procedure Test;
    begin
    TestStart:
    asm
    PUSH EAX
    POP EAX
    end;
    TestStop:
    end;

    </pre>

    Da kann er wenigstens compilieren (D3, asigabe dann

    <pre>

    @Test : 00488AC8
    TestStart: 00488AC9
    TestEnde : 00488ACB
    Diff : 00000002

    </pre>

    Gruß Hage

    Comment


    • #3
      Sorry, ich habe mich gerade gewundert wo der 1 Byte Versatz von @Test zu TestStart: herkommt. Jetzt kompiliert er auch obigen Vorschlag nicht mehr vorhin gings aber noch.

      Gruß Hagen

      PS: also mich nervt das, Borland sollte mal nicht soviel "große Tönespucker" als Coder einstellen. Langsam kotzt mich die Qualität die Borland abliefert echt an. Wenns so weitergeht, bzw. sich nichts radikal ändert spring ich ab, MS wartet schon mit seinem .NET und C#

      Comment


      • #4
        Ja hat mich auch geärgert, nach einigem Testen (ich hatte es nach etlichen Neustarts von Delphi dann ab-und-zu geschafft das wenigstens eine Exe erzeugt wurde...) mußte ich feststellen, das es mal geht und mal nicht.

        Jetzt werde ich wohl in aller Ruhe die Adresse als Rückgabewerte der Funktion schreiben, also noch Code drum basteln, damit ich an die Offsets komme...<br>
        Bin zwar nicht glücklich damit aber scheint nicht anders zu gehen =/

        Gruß Nic

        Comment


        • #5
          <html>
          <head>
          <title>Untitled</title>
          </head>
          <!-- Generated by ConTEXT HTML exporter -->
          <body text="#000000" bgcolor="#D0D0D0">
          <pre>
          <code><font face="Courier New"><font color="#000000"><b>var
          </b></font>Start<font color="#000000">, </font>Ende<font color="#000000">: </font>DWord<font color="#000000">;

          <b>procedure </b></font>Test<font color="#000000">;
          <b>asm
          </b></font><font color="#008080">MOV Start,OFFSET @@1

          @@1: PUSH EAX
          POP EAX

          @@2: MOV Ende,Offset @@2
          </font><font color="#000000"><b>end</b>;

          <b>procedure </b></font>TForm1<font color="#000000">.</font>Button2Click<font color="#000000">(</font>Sender<font color="#000000">: </font>TObject<font color="#000000">);
          <b>begin
          </b></font>Test<font color="#000000">;
          <b>with </b></font>Memo1<font color="#000000">.</font>Lines <font color="#000000"><b>do
          begin
          </b></font>Clear<font color="#000000">;
          </font>Add<font color="#000000">(</font><font color="#0000FF">'@Test : ' </font><font color="#000000">+ </font>IntToHex<font color="#000000">(</font>DWORD<font color="#000000">(@</font>Test<font color="#000000">), </font><font color="#0000FF">8</font><font color="#000000">));
          </font>Add<font color="#000000">(</font><font color="#0000FF">'TestStart: ' </font><font color="#000000">+ </font>IntToHex<font color="#000000">(</font>Start<font color="#000000">, </font><font color="#0000FF">8</font><font color="#000000">));
          </font>Add<font color="#000000">(</font><font color="#0000FF">'TestEnde : ' </font><font color="#000000">+ </font>IntToHex<font color="#000000">(</font>Ende<font color="#000000">, </font><font color="#0000FF">8</font><font color="#000000">));
          </font>Add<font color="#000000">(</font><font color="#0000FF">'&lt;Diff&gt; : ' </font><font color="#000000">+ </font>IntToHex<font color="#000000">(</font>Ende <font color="#000000">- </font>Start<font color="#000000">, </font><font color="#0000FF">8</font><font color="#000000">));
          <b>end</b>;
          <b>end</b>;

          </font></font>
          </code></pre>
          </body>
          </html&gt

          Comment


          • #6
            Danke =)

            Ich habe vor @@1 noch einen JMP auf @@2 (da der Code den ich dort generiere, Pseudo-16Bit ist und definitiv nicht ausgeführt werden kann.<br>
            (das nur als Ergänzung, es ging um das Problem, welches ich Dir als eMail geschickt hatte - RumDump.com)

            Gruß Nic

            Comment

            Working...
            X