AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Komischer ASM Code

Ein Thema von Luckie · begonnen am 10. Okt 2003 · letzter Beitrag vom 10. Okt 2003
Antwort Antwort
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#1

Komischer ASM Code

  Alt 10. Okt 2003, 06:22
Ich beschäftige mich jetzt etwas mit ASM und dabei bin ich über folgenden Code gestolpert:
Code:
    .WHILE TRUE                                                        ; Enter message loop
                invoke GetMessage, ADDR msg,NULL,0,0 
                .BREAK .IF (!eax)
                invoke TranslateMessage, ADDR msg
                invoke DispatchMessage, ADDR msg
   .ENDW
Offensichtlich eine Schleife. Nur in meinem ASM Buch werden Schleife so nicht realisiert, sondern mit Labels und Sprüngen. Es ist Code für MASM aus den Iczelion's Win32ASM Tutorials.

Könnte mir das mal bitte jemand erklären?
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
Robert Marquardt
(Gast)

n/a Beiträge
 
#2

Re: Komischer ASM Code

  Alt 10. Okt 2003, 06:28
Der Assembler kann offensichtlich ein paar einfache Hochsprachenkonstrukte.

Delphi-Quellcode:
  while True do
  begin
    if GetMessage(Msg, 0, 0, 0) = 0 then
      Break;
    // Anmerkung: hier fehlt ein IF
    TranslateMessage(Msg);
    DispatchMessage(Msg);
  end;
  Mit Zitat antworten Zitat
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#3

Re: Komischer ASM Code

  Alt 10. Okt 2003, 13:06
Ja, soweit war ich auch schon. Inzwischen habe ich rausgefunden, dass das wohl Makros sind, die mit einem Punkt anfangen. Aus der Hilfe zu MASM:
Zitat:
MASM High Level Syntax

In conjunction with the "invoke" syntax, MASM has a set of built in pseudo high level macros for value comparison and loop construction. While many have passed comments about the lack of low level code by using such built in macros, generally they cannot construct normal windows message handling procedures with anything like the same complexity and reliability without them.

The .IF syntax can be nested in the normal manner which makes the "switch block" style of WndProc message handling procedures possible. The alternative using "cmp reg, var", "jne label" produces nightmares in terms of tracking the number of jumps and labels needed and it does not perform any better or asemble any smaller.

The choice where complex conditional testing is required is between reliable fast code and unreadable and unfixable code, most eventually take the choice of doing this type of testing in a reliable and fast manner so that the difficult work in terms of speed and capacity can be done in a reasonably timescale.

.IF
.REPEAT
.WHILE
.BREAK
.CONTINUE
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:41 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz