flat assembler
Message board for the users of flat assembler.

Index > Main > pseudo NOP instruction

Author
Thread Post new topic Reply to topic
Ali.Z



Joined: 08 Jan 2018
Posts: 773
Ali.Z 23 Jan 2022, 10:09
I know for the fact that fasm use the shortest form available to encode instructions, so this not a bug report or whatsoever; but it would be nice to somehow be able to disable this optimization feature.

Code:
use32
; pseudo NOP instructions that are valid in 32-bit mode
; from 2 bytes, up to 9 bytes of pseudo NOP instructions

nop2:
; can assemble .......... YES
; assembled correctly ... YES
; expected bytes ....... 66 90
; assembled bytes ....... 66 90
db 66h
nop



nop3:
; can assemble .......... YES
; assembled correctly ... YES
; expected bytes ....... 0f 1f 00
; assembled bytes ....... 0f 1f 00
nop dword [eax]



nop4:
; can assemble .......... YES
; assembled correctly ... NO
; expected bytes ....... 0f 1f 40 00
; assembled bytes ....... 0f 1f 00
nop dword [eax+00h]



nop5:
; can assemble .......... YES
; assembled correctly ... NO
; expected bytes ....... 0f 1f 44 00 00
; assembled bytes ....... 0f 1f 04 00
nop dword [eax+eax*1+00h]



nop6:
; can assemble .......... YES
; assembled correctly ... NO
; expected bytes ....... 66 0f 1f 44 00 00
; assembled bytes ....... 66 0f 1f 04 00
db 66h
nop dword [eax+eax*1+00h]



nop7:
; can assemble .......... YES
; assembled correctly ... NO
; expected bytes ....... 0f 1f 80 00 00 00 00
; assembled bytes ....... 0f 1f 00
nop dword [eax+00000000h]



nop8:
; can assemble .......... YES
; assembled correctly ... NO
; expected bytes ....... 0f 1f 84 00 00 00 00 00
; assembled bytes ....... 0f 1f 04 00
nop dword [eax+eax*1+00000000h]



nop9:
; can assemble .......... YES
; assembled correctly ... NO
; expected bytes ....... 66 0f 1f 84 00 00 00 00 00
; assembled bytes ....... 66 0f 1f 04 00
db 66h
nop dword [eax+eax*1+00000000h]    

_________________
Asm For Wise Humans
Post 23 Jan 2022, 10:09
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20536
Location: In your JS exploiting you and your system
revolution 23 Jan 2022, 11:01
The usual method is to create a macro or equ for what you need.
Code:
macro nop2 { db 0x66, 0x90 }    
Post 23 Jan 2022, 11:01
View user's profile Send private message Visit poster's website Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 773
Ali.Z 24 Jan 2022, 13:09
this should be sufficient for my tests, thanks.

_________________
Asm For Wise Humans
Post 24 Jan 2022, 13:09
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.