flat assembler
Message board for the users of flat assembler.
Index
> Main > no jump Goto page 1, 2 Next |
Author |
|
MazeGen 07 May 2009, 07:16
Code: mov ax, 0x0BFF mov bx, 0x0B00 cmovz ax, bx Requires Pentium Pro. CMOVcc is similar to conditional jumps, you can use CMOVZ, CMOVNZ etc. |
|||
07 May 2009, 07:16 |
|
bitshifter 07 May 2009, 07:40
Yes MazeGen, that was exactly what my first attempt looked like.
I also thought there might be a nice way to use lahf with a mask. I had even considred a method using set* with a twist. _________________ Coding a 3D game engine with fasm is like trying to eat an elephant, you just have to keep focused and take it one 'byte' at a time. |
|||
07 May 2009, 07:40 |
|
revolution 07 May 2009, 08:06
If you wanted "if CF==1 then ax=0xbff, else 0xb00" then:
Code: salc mov ah,0xb |
|||
07 May 2009, 08:06 |
|
bitshifter 07 May 2009, 08:25
Very cool revolution, but it only can use ZF.
_________________ Coding a 3D game engine with fasm is like trying to eat an elephant, you just have to keep focused and take it one 'byte' at a time. |
|||
07 May 2009, 08:25 |
|
Picnic 07 May 2009, 08:54
MazeGen wrote:
I never use those instructions so far, but they look very handy! |
|||
07 May 2009, 08:54 |
|
Madis731 07 May 2009, 10:09
Careful, though, when you start using them and realize there's a 64-bit world, then some of these "ingenious" instructions are overwritten for better compacting of more usual code!
CMOVcc stayed, but AA* instructions were removed and SALC (which is even in FASM code ). |
|||
07 May 2009, 10:09 |
|
bitshifter 07 May 2009, 14:54
Im still stuck in the 16/32 bit world. lol
Pretty soon we will have instructions like jncgfrwasioxprtn How bad is that gonna suck? You can keep your 64 bit system (no offense intended). |
|||
07 May 2009, 14:54 |
|
bitRAKE 07 May 2009, 15:25
Code: setz al mov ah,$0B dec al Nah, the new instructions will be like (LRBni): vmadd231ps v0 {k1},v5,[rbx+rcx*4] vcmpleps k2,{k2},v25,[ConstantFloatOne] {1to16} Really! |
|||
07 May 2009, 15:25 |
|
Madis731 07 May 2009, 15:33
Yeah, I know
|
|||
07 May 2009, 15:33 |
|
Coddy41 07 May 2009, 15:41
bitshifter wrote: Im still stuck in the 16/32 bit world. lol. You meen I'm not the only one? _________________ Want hosting for free for your asm project? You can PM me. (*.fasm4u.net) |
|||
07 May 2009, 15:41 |
|
bitshifter 07 May 2009, 17:48
bitRAKE wrote:
Yes! Thats the one i wanted! I was playing with setz for a while but couldnt get it to work right. My version was off by one, but i never considered just letting it wrap around. *dances in circles* _________________ Coding a 3D game engine with fasm is like trying to eat an elephant, you just have to keep focused and take it one 'byte' at a time. |
|||
07 May 2009, 17:48 |
|
MHajduk 07 May 2009, 19:59
If you want EFLAGS register untouched you can do something like that:
Code: setz al movzx eax, al lea eax, [eax - 1] movzx eax, al mov ah, 0x0B |
|||
07 May 2009, 19:59 |
|
LocoDelAssembly 07 May 2009, 20:23
MHajduk, you don't really need to zero extend anything, it will work without it:
Code: setz al lea eax, [eax - 1] ; EAX[7:0] = 0xFF if not ZF ; EAX[7:0] = 0x00 if ZF mov ah, 0x0B EAX[31:16] will hold garbage instead of zero of course but setting it to zero is also destroying the original value so no extra harm here. |
|||
07 May 2009, 20:23 |
|
comrade 07 May 2009, 20:31
Here is another one, FWIW:
Code: setnz al neg al mov ah, $0B |
|||
07 May 2009, 20:31 |
|
Madis731 08 May 2009, 06:21
Sometimes its even useful to read TFM
Intel Instruction Set Reference 2B p. 391 wrote:
That's exactly the case as I understand. I'm really glad that they decided to keep the SETcc in 64-bit and even extend it with RAX supporting all the r15b and r9d I would really like to defend my choice of 64-bit. I know everyone has their own flavour, but 16-bit is starting to die out and it has memory concerns as well. 64-bit is a nice desert where "all your flat memorys are belong to us". In usual scenarios it will compile in less bytes than 16-bit code would. I'm not talking about weird hacks, but still in this bit-twiddling example 32/64-bit wins: Code: use16 ;9 bytes setz al lea ax,[eax-1] ;Original with eax is even 10 bytes mov ah,0x0B use32 ;8 bytes setz al lea eax,[eax-1] mov ah,0x0B use64 ;8 bytes setz al lea eax,[rax-1] mov ah,0x0B So if not 64-bit then at least 32-bit |
|||
08 May 2009, 06:21 |
|
bitRAKE 08 May 2009, 15:25
Well, to be fair,
Code: setz al ; 0F 94 C0 dec ax ; 48 mov ah,$0B ; B4 0B |
|||
08 May 2009, 15:25 |
|
bitshifter 08 May 2009, 15:44
It's cool to see so many people getting involved
in this and sharing their ideas with each other. I love to see threads like this. |
|||
08 May 2009, 15:44 |
|
Madis731 08 May 2009, 16:31
6 bytes... nice, can everyone make a 5-byte one?
Why I get involved: Optimization is my true guiding light I want to be a game-programmer in the future and write the most efficient 3D-game-engine EVER !!! And I'm not 13 ... PCMPISTRI xmm0,xmm1,100b is my line-of-the-day |
|||
08 May 2009, 16:31 |
|
bitshifter 08 May 2009, 19:04
Madis731 wrote: 6 bytes... nice, can everyone make a 5-byte one? Guess its time to break tho old TSCWin Quote: and write the most efficient 3D-game-engine EVER Right on, brother Quote:
The last time i cut my hair was before some of this kids were even born. _________________ Coding a 3D game engine with fasm is like trying to eat an elephant, you just have to keep focused and take it one 'byte' at a time. |
|||
08 May 2009, 19:04 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.