Re: asm and nasm newbie




wolfgang kern wrote:
> Zhang Huan wrote:
>
> | do you mean that for such code
> | jmp addr32
> | by adding 66h prefix, the operand will be only 16bit and, the high
> | 16bit is ignored
>
> No. I better hadn't mentioned this rare usable options :)
> I once used it for tricky mixed 16/32 code links,
> but I soon replaced it by more flexible ways.

when i knew the 66h prefix, i wondered whether it can help me. actually
i must write an INT13h handler, an implementing a simplied RPC
protocol. it would be much better if i can implement it in c, for time
is so limited. however gcc cannot correctly compile c to 16bit-code in
the case of memory access. but i think i can do something to change the
assemble code gcc compiled.

>
> If you use (assuming 16 bits by default yet):
>
> 66 e9 xx xx xx xx jmp +x ;then the branch offset is also affected.
>
> But as the jumped target cannot be outside the 64KB segment,
> it is somehow useless in 16-bit mode.
>

sorry for my poor english :), do you mean that high 16bit address is
ignored??

and how to add such prefix, for example, in gas

> | and what about the "call" instruction
>
> Same as for jump, but rare recomendable!
> the pushed return address is 32-bits wide then,
> this means it will need a RETD (66 c3) to come back.
>
> The opposite, if in 32-bit mode:
>
> 66 e9 xx xx jmp+x ;will work as jump to Zero-page
> ;because the high word of EIP becomes truncated
>
> | and what about the "call" instruction
>
> Same as for jump, but not recomendable at all!
> the pushed return address is just 16 bits wide then.
>
> I hope I didn't add too many confusion with the uncommon...
>
no, you're justing "unconfusing" me :)

> __
> wolfgang

.



Relevant Pages

  • Re: count2.asm
    ... wolfgang kern wrote: ... > I have no report on any CPU for ADC being slower than ADD. ... something I remember reading when the PIV first came out. ... instruction was horribly slow and I figured, ...
    (alt.lang.asm)
  • Re: 7 segment display
    ... Wolfgang Kern wrote: ... the avoidable L12..L20 spagetthi, ... The programmer decides whether he wants a jump or data table. ...
    (alt.lang.asm)
  • Re: How to encode an unconditional jump in 64-bit mode?
    ... "Wolfgang Kern" wrote in message ... indirect, address given in m16:64" ... use this kind of instruction? ... (is jmp cs:1122334455667788h correct?) ...
    (alt.lang.asm)