000
05.02.2003, 23:00
WareWolf
|
seit 2 Tagen probier ich nun den Assembler NASM, vorher hab ich mit dem A86 gearbeitet. Folgendes hat mich soeben für einen läpischen 20 Zeiler Testprogramm 1 Stunde Fehlersuche und wilde Abstürze beschert:
ich machte einen Tippfehler im Code, wollte schreiben:
push cs pop ds
aber ich schrieb:
push cs pop cs
der Code sieht eigentlich ganz vernünftig aus, hat nur keinen rechten Sinn. Das Merkwürdige daran ist, dass der NASM das problemlos ohne Fehler kompiliert hat, obwohl es in der IntelWelt keinen Befehl pop cs gibt. Ja, er hat sogar für den Befehl einen Opcode erzeugt (0f). Dieser Opcode bewirkt nun aber kein popen vom Stack. Ich bin im Debugger_trace Zeile für Zeile durch, dieser 1Byte(!) Opcode DB 0F bewirkt kein Decrementieren des StackPointers und lässt auch sonst alle Register in Ruhe, nein .. er erhöht einfach den Programmzeiger IP um 4 Bytes, so dass er anschliessend schön wild in den Code zeigt. Dort wird dann natürlich das Programm fortgesetzt und ... Chip on holliday
Hmm, ich weiss jetzt nicht mehr so recht, was ich vom Nasm halten soll...was ist Eure Meinung/Erfahrung ?
--
Sig as a brick ┴┬┴┬┴┬┴┬┴┬┴┬┴ WW
|
|
Profil || Suche
|
001
05.02.2003, 23:27
Tron
|
ist kein bug. man koennte jetzt rtfm sagen (;
aus der dokumentation zu NASM
B.4.244 POP: Pop Data from Stack
POP reg16 ; o16 58+r [8086] POP reg32 ; o32 58+r [386]
POP r/m16 ; o16 8F /0 [8086] POP r/m32 ; o32 8F /0 [386]
POP CS ; 0F [8086,UNDOC] POP DS ; 1F [8086] POP ES ; 07 [8086] POP SS ; 17 [8086] POP FS ; 0F A1 [386] POP GS ; 0F A9 [386]
POP loads a value from the stack (from [SS:SP] or [SS:ESP]) and then increments the stack pointer.
The address-size attribute of the instruction determines whether SP or ESP is used as the stack pointer: to deliberately override the default given by the BITS setting, you can use an a16 or a32 prefix.
The operand-size attribute of the instruction determines whether the stack pointer is incremented by 2 or 4: this means that segment register pops in BITS 32 mode will pop 4 bytes off the stack and discard the upper two of them. If you need to override that, you can use an o16 or o32 prefix.
The above opcode listings give two forms for general-purpose register pop instructions: for example, POP BX has the two forms 5B and 8F C3. NASM will always generate the shorter form when given POP BX. NDISASM will disassemble both.
POP CS is not a documented instruction, and is not supported on any processor above the 8086 (since they use 0Fh as an opcode prefix for instruction set extensions). However, at least some 8086 processors do support it, and so NASM generates it for completeness. NASM ist der beste assembler, den ich kenne, funktioniert einwandfrei, gibt's fuer umme: was will man mehr?
--
'KEINE PANIK' - aus der Triologie in fuenf Baenden von Douglas Adams
'FÜR DEINN FERD' - aus 'Gevatter Tod' von Terry Pratchett
Dieser Beitrag wurde am 05.02.2003 um 23:27 von Tron bearbeitet.
|
|
Profil || Suche
|
002
06.02.2003, 08:38
Kriz
|
Die anderen Compiler und Linker gibbet auch für Umme... wenn man weiß, wo und wann und wie und überhaupt >=)
--
K:R-I)Z++ "CSS ist cascading style sheets. Und nicht so'n Ranzspiel." - dp In memory of Voice ( 2005/03/30)
|
|
Profil || Suche
|
003
06.02.2003, 08:46
WareWolf
|
oh, da bin ich aber schön auf den Arsch gefallen...sollte doch ab und zu Docus lesen =) aber wer hat schon noch einen XT 4MhZ mit 8086 drin? was solls, aber ich denke der nasm "passt scho" thx
--
Sig as a brick ┴┬┴┬┴┬┴┬┴┬┴┬┴ WW
|
|
Profil || Suche
|