Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   [ASM] Prefix 16/32 Bit -> 66h (https://www.delphipraxis.net/22901-%5Basm%5D-prefix-16-32-bit-66h.html)

neolithos 25. Mai 2004 21:33


[ASM] Prefix 16/32 Bit -> 66h
 
Einfaches Bsp:

inc eax
ergibt bei mir -> Hex: 66h 40h

bei Delphi aber nur 40h!
Wieso läßt Delphi das Präfix weg. Welches zwischen den 32 und 16 Bit inc unterscheidet.

denn inc ax
ist ja auch 40h

Wie läuft das nun mit dem Präfix-Byte?

Christian Seehase 25. Mai 2004 21:54

Re: [ASM] Prefix 16/32 Bit -> 66h
 
Moin Neolithos,

Zitat:

Zitat von neolithos
denn inc ax
ist ja auch 40h

nein, inc ax ist 66h 40h, inc eax hingegen 40h

neolithos 25. Mai 2004 22:01

Re: [ASM] Prefix 16/32 Bit -> 66h
 
Warum macht es aber NASM genau anders herum?

Bei NASM ist

inc eax mit 66h
und
inc ax ohne 66h

:gruebel: Das verwirrt mich ein wenig!

Christian Seehase 25. Mai 2004 22:05

Re: [ASM] Prefix 16/32 Bit -> 66h
 
Moin Neolithos,

gute Frage.
Gemäss Dokumentation von Intel (Instruction Set Reference - Order Number 245471-011) ist 66h ein Prefix für 16 Bit Befehle, wenn die CPU im 32 Bit Modus läuft.
Für viele Befehle ist dieser noch nicht einmal nötig, wenn der andere Operand schon festlegt, ob es sich um einen 16 oder 32 Bit Wert handelt.

neolithos 25. Mai 2004 22:17

Re: [ASM] Prefix 16/32 Bit -> 66h
 
Neue Erkenntnis:

Dieses Flag-Schaltet den aktuellen Modus um!

=> NASM -> 16 Bit Programme
=> Delphi -> 32 Bit Programme

Wie kann man jenes aber bestimmen?

Christian Seehase 25. Mai 2004 22:22

Re: [ASM] Prefix 16/32 Bit -> 66h
 
Moin Neolithos,

Zitat:

Zitat von neolithos
Wie kann man jenes aber bestimmen?

in Delphi:
Wohl gar nicht, denn es handelt sich ja schliesslich um einen 32 Bit Compiler.

in NASM:
keine Ahnung.

neolithos 25. Mai 2004 22:26

Re: [ASM] Prefix 16/32 Bit -> 66h
 
Es geht hier um eine theoretische Überlegung des Compiler-Bau's für ein eigenes OS.

Damit ist die Frage noch nicht beendet. Wie bestimmt man das nun?

neolithos 25. Mai 2004 22:29

Re: [ASM] Prefix 16/32 Bit -> 66h
 
Juhu ich habs!

Das kann nur im Protection-Mode festgelegt werden. Und dort im Code-Segment-Descriptor.

Xenon 22. Jun 2004 20:09

Re: [ASM] Prefix 16/32 Bit -> 66h
 
sry das ich das Thema wiedererwecke, obwohl es schon 1 Monat her is, aber ich hab heute was gesucht, was mir sehr geholfen hat und da hab ich diesen Thread hier gefunden und will jetzt mal so gut sein und das für NASM beantworten:

Code:
[Bits 32]
weist NASM an 32 Bit Code zu erstellen.

Delphi-Quellcode:
var i: array [1..5] of integer;
    j: integer;
    p: ^integer;
begin
  p := @i[1];
  asm
        MOV ECX, 5
        @@l:
        MOV EBX, p
        MOV EAX, ECX           //for j:=1 to 5 do
        DEC EAX                //  i[j] := j;
        IMUL EAX, 4
        ADD EBX, EAX
        MOV [EBX], ECX
        LOOP @@l
  end;
end;
hab ich übrigens durch die hilfe des forums geschafft =)


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:49 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz