flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Tomasz Grysztar
fasm by default generates the shorter code (the one with imm8), unless you force the full 16-bit immediate size by writing ADD BX, WORD 0x20.
|
|||
![]() |
|
CodeX
Yes, you're right. It works fine for 0x20, but doesn't work for 0xFF. It still generates extra zeroes.
|
|||
![]() |
|
MazeGen
As you said, imm8 is sign-extended, so this "sign extension" feature can't work for ADD BX, 0xFF (0x00FF), because it would be ADD BX, 0xFFFF then.
|
|||
![]() |
|
CodeX
1. "Intel says" it should work, though it produces the same result as SUB BX, 1 with reduced command length
2. "Intel says" it should also work with such commands as XOR, like XOR BX, 0xE8, giving the same result as XOR BX, 0xFFE8 but one byte shorter (3 bytes shorter with EBX). And I can't replace this command with anything else having the same result and the same length. Or is it just my wrong interpretation of what does "Intel say"? |
|||
![]() |
|
LocoDelAssembly
CodeX wrote: XOR BX, 0xE8, giving the same result as XOR BX, 0xFFE8 but one byte shorter (3 bytes shorter with EBX). "XOR BX, 0xE8" only affects the bits in BL and "XOR BX, 0xFFE8" affects BH and BL.Clearly it isn't for far the same. [edit]Sorry, I misunderstood what you said?[/edit] Last edited by LocoDelAssembly on 07 Mar 2006, 16:05; edited 1 time in total |
|||
![]() |
|
Tomasz Grysztar
When you write "XOR BX, 0xFFE8" fasm generates the shortened form, just like you need. Same with "ADD BX,0FFFFh" and "ADD BX,-1". And "SUB BX,1" will be short form also, so there is no advantage in using "ADD BX,-1" instead of it.
|
|||
![]() |
|
CodeX
Cool
![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.