flat assembler
Message board for the users of flat assembler.

Index > OS Construction > 16bit opcodes

Author
Thread Post new topic Reply to topic
Bluebat



Joined: 18 Mar 2006
Posts: 2
Bluebat 18 Mar 2006, 13:27
I have a problem with fasm. I write in my kernel mov eax,0x10001 (after going to pmode ang "use32"), then cli hlt and run it in bochs. In bochs log, there is EAX=00000001 (it is cut-off to 16bit). Then I decompiled it, and I see mov ax,0x0001 Razz
Why is that not what I written? Tried on small files (only this mov eax,0x10001 and still doesn't work)
Does someone know, what to do to get 32bit opcodes? Please, help[/code]
Post 18 Mar 2006, 13:27
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 18 Mar 2006, 13:38
Make sure that you disassemble with the same bitness as you assembled it (32 in this case). Many disassemblers (like HIEW or BIEW, for quick example) disassemble flat binary files as "use16" by default.
Post 18 Mar 2006, 13:38
View user's profile Send private message Visit poster's website Reply with quote
Bluebat



Joined: 18 Mar 2006
Posts: 2
Bluebat 18 Mar 2006, 17:01
I disasembled it with ndisasm (nasm package) and BOCHS (cli hlt just before it). And also BOCHS executes it as mov ax,0x0001 even if in protected mode.
Post 18 Mar 2006, 17:01
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 18 Mar 2006, 17:13
So either it is the 16-bit protected mode, or you have assembled it to 16-bit (without "use32").
Post 18 Mar 2006, 17:13
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 20 Mar 2006, 08:41
mov eax,0x10001 should assemble to 6 bytes in 16-bit mode and 5 bytes in 32-bit mode. Check it!
Post 20 Mar 2006, 08:41
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger 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.