flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > minor problems

Author
Thread Post new topic Reply to topic
segfault



Joined: 09 Nov 2004
Posts: 1
segfault 11 Nov 2004, 05:21
Code:
       format binary
       use16
       org  0
head:  jmp  byte tail
       rb   65536-4    ;gap
tail:  jmp  byte head
    

In 16-bit mode, these jmps can be coded as 'EB,FC' and 'EB,00'.
Fasm can't assemble them, though x86 processors execute them
just as expected.
Yes, they look something weird, but there is 'mov es,eax' too.

Code:
       format binary
       use16
       org  0
top:   ret
       rb   65536-4    ;gap
       call top
    

Internally, fasm dose '0-65536' to get the call's operand, I think.
That means fasm accepts -65536 to 65535 as IP-relatives in 16-bit mode.
Displacements are kind of register-relatvies, but fasm rejects them
in the range of -65536 to -32769 like [bx-60000].
Of cource, displacements in the range of -65536 to -65409
and 65408 to 65535 can be optimized by 8-bit values in 16-bit mode.

There are same ploblems in 32-bit mode, though the 'gap' is 4GB.

That's all.
Post 11 Nov 2004, 05:21
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.