Hi Tom,

That's nice of you to provide the explanation. I didn't read it 
completely (too lazy), nor understand it fully (too stupid), but the 
other clueless guy might find it interesting that he was only half wrong.

At the end of the day, I will keep using "JZ SHORT" anyway, 'cause that 
just works for me.

cheers,
Mateusz





On Tue, 11 Apr 2017 12:33:17 +0200, Tom Ehlert wrote:
>>>> Unless I'm mistaken, conditional jumps on 8086 don't go beyond -128
>>>> ..
>>>> 127 (signed) byte range. Hence the billions of workarounds (TASM
>>>> "jumps", MASM "option ljmp", etc).
> right.
> 
>>> I won't argue about what opcode is or is not available on 8086, since
>>> I did not bother decoding their exact meaning.
> 
> meaning 'I am a lazy, clueless guy, but write anyway ...'
> 
>>> I do see however that (NASM at least) can assemble JZ and JZ SHORT in
>>> two very different forms, JZ SHORT being significantly shorter.
>>>
>>>   5 00000000 B80100          mov ax, 1 6 00000003 48              dec
>>>   ax 7 00000004 746A            jz short gameover
>>>
>>>   5 00000000 B80100          mov ax, 1 6 00000003 48              dec
>>>   ax 7 00000004 7503E9DD01      jz gameover
>>>
>>> Of course NASM always uses the short form whenever it's possible, but
>>> when the jump is too far away it silently uses the longer form, hence
>>> the need to always specify SHORT if one wants to be sure what's going
>>> on.
> 
>> AFAIK,
> meaning 'I am completely clueless , but offer my unfounded opinion
> anyway ...'
> 
>> the longer one is 386+ only, hence not available with "cpu 8086". Thus,
>> if it still quietly assembles, that is a bug (but I thought that was
>> long-ago fixed/avoided).
> 
> the longer one is 2 instructions instead, automatically generated by
> NASM because the intended jump goes farther then 127 bte
> 
> 
> c:\>debug -e 100 1430:0100  00.75   00.03   00.e9   00.dd   00.01 -u 100
> 1430:0100 7503          JNZ     0105 1430:0102 E9DD01        JMP    
> 02E2
> 
> 
> Tom


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to