flat assembler
Message board for the users of flat assembler.
Index
> Main > The most useless instruction Goto page Previous 1, 2, 3, 4, 5, 6, 7 Next |
Author |
|
bzdashek 31 Mar 2012, 12:44
The most rarely used instruction in Windows, I believe is int
|
|||
31 Mar 2012, 12:44 |
|
bzdashek 31 Mar 2012, 14:51
What I meant is that interrupts are not used in Windows env as often as in for example DOS.
Also, could you please provide some code or link for educational purposes ? I just haven't seen using int in any examples I put my hands on. |
|||
31 Mar 2012, 14:51 |
|
revolution 31 Mar 2012, 14:58
bzdashek wrote: What I meant is that interrupts are not used in Windows env as often as in for example DOS. |
|||
31 Mar 2012, 14:58 |
|
bzdashek 31 Mar 2012, 15:21
revolution wrote: Windows just hides int behind an API. I don't argue with that. I was writing about the user-level applications, there you won't see much int calls, would you? |
|||
31 Mar 2012, 15:21 |
|
gunblade 02 Apr 2012, 12:57
bzdashek: int is VERY common in 32-bit linux (and other *nix) assembly, as that is the way you call syscalls. It has now changed in 64-bit to the instruction "syscall", however up until very recently (and still, for people who are doing 32-bit applications in linux in assembly (i know theres not that many of us.. but still )) it was one of the most used instructions (maybe an exageration, but it was at least once in every program, since you need it to call the system's exit() syscall in order to exit properly (similar to windows' ExitProcess).
To be fair - you did say "in windows".. so yeah.. but just wanted to point that out anyway.. |
|||
02 Apr 2012, 12:57 |
|
El Tangas 07 Apr 2012, 18:08
I think xlat is quite useless.
|
|||
07 Apr 2012, 18:08 |
|
16bitPM 07 Apr 2012, 19:50
El Tangas wrote: I think xlat is quite useless. If I'm not mistaken it's used in the FLAT assembler It's not a useless instructiion. It doesn't quite follow the "go RISC" ideology but hell, who cares anyway since they now decided to include all sorts of extremely high-level/task-specific instructions in the processors (AES, for example). Shorter is still often better by the way. More efficient use of cache and prefetch queue, but also the fact that modern processors can do other stuff while the slow instruction is executing. So overall, using extremely speed-optimized code all the time may actually slow things down. My rule #1: go for size without going out of the way, then optimize really critical sections for speed. |
|||
07 Apr 2012, 19:50 |
|
shutdownall 07 Apr 2012, 20:23
I use xlat (which has to be xlatb for FASM ).
It's advantage is to easy convert with conversion table without using too much registers. In fact it is very powerful. Code: lodsb xlatb stosb is easy to transfer data form A to B with conversion of a table. How else would you do this ? It's equivalent is mov al,[ebx+al] but this instruction is not possible. If edi and esi are in use it is a perfect and powerful instruction. Only one byte size and really fast execution. |
|||
07 Apr 2012, 20:23 |
|
shutdownall 07 Apr 2012, 20:27
Really strange is XBTS which was later removed from Intel because it was mainly useless.
XBTS op1,op2,op3,op4 (extract bit string) Now it throws in invalid exception if it is not running on 80386. |
|||
07 Apr 2012, 20:27 |
|
16bitPM 07 Apr 2012, 20:56
shutdownall wrote: Really strange is XBTS which was later removed from Intel because it was mainly useless. Actually it's only recognized on very early 80386 CPU's (before the ΣΣ mark). |
|||
07 Apr 2012, 20:56 |
|
Tomasz Grysztar 08 Apr 2012, 07:18
shutdownall wrote: I use xlat (which has to be xlatb for FASM ). It is used at least 15 times in fasm sources, though never in the XLATB form - this is because in early versions the same source code was assembled either into 16-bit or 32-bit code depending on version, so fully qualified form had to be written to ensure that EBX is always used for addressing. The same thing with instructions like LODS, MOVS, etc. |
|||
08 Apr 2012, 07:18 |
|
edfed 08 Apr 2012, 09:26
shutdownall wrote:
it's more like this: Code: movzx eax,al mov al,[ebx+eax] ones you got this pattern, you can use any registers to do the xlat thing. but xlat is xlat and is cool to use since it's a specialized case of this two instructions snippet, and it kepps the eax upper bytes unchanged. most useless instruction would be the amd 3Dnow sub-instruction set. |
|||
08 Apr 2012, 09:26 |
|
16bitPM 08 Apr 2012, 17:13
edfed wrote: most useless instruction would be the amd 3Dnow sub-instruction set. Why?? It's used in MPLAYER. |
|||
08 Apr 2012, 17:13 |
|
shutdownall 08 Apr 2012, 17:26
edfed wrote: ones you got this pattern, you can use any registers to do the xlat thing. Okay but this coding uses 8 bytes in output file instead of only one and don't ask about execution time. Even with many pipelines which speed up xlat same way and doesn't fill the L1 cache too much. Nowheredays people don't think to much about code size or execution time. |
|||
08 Apr 2012, 17:26 |
|
shutdownall 08 Apr 2012, 17:29
Tomasz Grysztar wrote: unless you mean that it has to be XLATB if you don't want to write an operand. Can you give an example with operand ? As found in a manual, operand can be only a segment register to overwrite default segment register of bx (or ebx). I tried many examples and didn't get any to be accepted. And in FASMW.ASM you use same only simple form "xlatb" (6 times). |
|||
08 Apr 2012, 17:29 |
|
Tomasz Grysztar 08 Apr 2012, 18:43
shutdownall wrote: And in FASMW.ASM you use same only simple form "xlatb" (6 times). Manual gives examples for LODS/MOVSB/etc. instructions, XLAT syntax is defined later in document and is analogous. As the manual states, it takes memory operand, with only BX/EBX and possibly segment prefix allowed (also RBX in long mode, but that is covered by a later section). |
|||
08 Apr 2012, 18:43 |
|
edfed 08 Apr 2012, 18:47
16bitPM wrote:
lol, MPLAYER is a useless application since there are many open source and better media players. for the 8 bytes vs 1 byte, it is sure, really sure that the two instruction pattern is less preferable than the one instruction xlat, and that's why intel implemented xlat and all other complex instructions. string operations for example are good example of complex instructions that can be made with reduced instructions. |
|||
08 Apr 2012, 18:47 |
|
16bitPM 09 Apr 2012, 10:48
edfed wrote: lol, MPLAYER is a useless application since there are many open source and better media players. MPLAYER is considered by many to be THE best media player... Especially with modern skins! Quote: for the 8 bytes vs 1 byte, it is sure, really sure that the two instruction pattern is less preferable than the one instruction xlat, and that's why intel implemented xlat and all other complex instructions. string operations for example are good example of complex instructions that can be made with reduced instructions. Absolutely not. Those instructions were introduced in the 8086/8088. In later manuals (i.e. 80486 and especially Pentium and above), Intel recommended NOT to use those and many other instructions in speed-critical sections. Regardless of Intels recommendations however, it's often observed that tight code is still better. It's a matter of choice really, or better: cautiously choosing which sections you can optimize further for speed. |
|||
09 Apr 2012, 10:48 |
|
shutdownall 09 Apr 2012, 18:01
Tomasz Grysztar wrote: (so "xlatb" will always be equal to "xlat [ebx]"). Okay - I didn't expect to be used as memory referencing. Thought "xlat bx" or "xlat ebx" to be used. |
|||
09 Apr 2012, 18:01 |
|
Goto page Previous 1, 2, 3, 4, 5, 6, 7 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.