flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [opcode] pushing a 32bit (byte sized) value in real mode

Author
Thread Post new topic Reply to topic
rain_storm



Joined: 05 Apr 2007
Posts: 67
Location: Ireland
rain_storm 20 Oct 2017, 20:18
In real mode there are two ways to push a 32 bit byte sized value. The 66 68 version encodes and entire 32bit immediate within the instruction. The 66 6A version encodes only an 8bit immediate which is sign extended to 32bits when executed.

Code:
use16
push large 0 ; 66 6A 00
push dword 0 ; 66 68 00 00 00 00
    


I've seen the push large syntax in IDA Pro for the opcode 66 6A 00 but it doesn't translate to FASM syntax directly. How can I force FASM to generate the 66 6A version.
Post 20 Oct 2017, 20:18
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 20 Oct 2017, 20:25
Use PUSHD mnemonic to get the size-optimized 32-bit version in 16-bit mode.
Post 20 Oct 2017, 20:25
View user's profile Send private message Visit poster's website Reply with quote
rain_storm



Joined: 05 Apr 2007
Posts: 67
Location: Ireland
rain_storm 20 Oct 2017, 20:29
Brilliant! Thanks Tomasz.
Post 20 Oct 2017, 20:29
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.