flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > How many FLAGS can you juggle at once? |
Author |
|
bitRAKE 27 Nov 2008, 20:54
Very nice.
If we look at it from the perspective of X = ( (code + data) bytes / branch targets) then as branches -> inf, X -> 1. What is the smallest number of branches where X < 2? (Using same initial assumption of variable in register. Also targets cannot be sequential or direct mapping because then we could just use JMP EAX, or silly stuff like NEG EAX/JMP EAX.) For amd64, 17 branches minimum: Code: mov al,[tab+rax] lea rax,[base+rax*8] jmp rax |
|||
27 Nov 2008, 20:54 |
|
baldr 27 Nov 2008, 21:46
bitRAKE,
Is your tab 4 GiB in size? xlat for sure. I'm talking about understanding of [RE]?FLAGS. I have an essay about flags, around 10…15 lines, explaining them a bit. Would it be useful to post it? |
|||
27 Nov 2008, 21:46 |
|
bitRAKE 27 Nov 2008, 22:01
Something like:
Code: sahf ; why cmp? ja _..0..0 . . . (many more branches...) _..0..0: jge _OS0..0 ; = jno _010..0 jnp _100.00 ; X jmp _100.10 ; X _OS0..0: jno _000..0 jnp _110.00 ; X jmp _110.10 ; X _000..0: jnp _000.00 ; X jmp _000.10 ; X _010..0: jnp _010.00 ; X jmp _010.10 ; X (bytes greater than two per branch target) No tab is only 15/16 bytes. XLAT is good, but requires (E/R)BX which is additional byte to load register. What to limit input values, huh? Last edited by bitRAKE on 27 Nov 2008, 22:11; edited 1 time in total |
|||
27 Nov 2008, 22:01 |
|
baldr 27 Nov 2008, 22:10
bitRAKE,
With lahf you'll lose 3 bits of ah, definitely. Test for AF will be complicated too. Not to mention #UD in 64-bit mode occasionally… Last edited by baldr on 27 Nov 2008, 22:24; edited 2 times in total |
|||
27 Nov 2008, 22:10 |
|
bitRAKE 27 Nov 2008, 22:13
bah, SAHF -- not LAHF.
|
|||
27 Nov 2008, 22:13 |
|
baldr 27 Nov 2008, 22:16
bitRAKE,
Same mistake. Looked up sahf and wrote lahf… |
|||
27 Nov 2008, 22:16 |
|
bitRAKE 28 Nov 2008, 02:06
baldr wrote: I have an essay about flags, around 10…15 lines, explaining them a bit. Would it be useful to post it? _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
28 Nov 2008, 02:06 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.