Page 1 of 2

Assembler problems

Posted: Sat Nov 21, 2015 8:39 pm
by wilbert
I tried a very simple instruction

Code: Select all

!movq rax, xmm0
which is not working on PB 5.40 Linux (x64).

When I started comparing assembler versions that come with PureBasic, I wasn't surprised.

PB 5.40 (x64) OSX comes with YASM 1.2.0 from 2012
PB 5.40 (x64) Windows comes with FASM 1.69.35 from 2011
PB 5.40 (x64) Linux comes with FASM 1.67.18 from 2006 :(

I just don't understand why those aren't updated.
It makes it very difficult to write cross platform code this way that works on all systems.
I just don't know how to make my sha3 module code work now on all three systems.
I need to move 64 bit values between a xmm register and a 64 bit register and it just doesn't seem possible on Linux out of the box.
Anyone has a suggestion that works with the fasm version that comes with PB ?

Re: Assembler problems

Posted: Sat Nov 21, 2015 9:06 pm
by Keya
+10!!! how nice would it be (but not just nice, important) to have the latest assemblers as part of PB :) :) :) and its nearly Christmas, Fred!

surely all of those assemblers have had a lot of bugs fixed in the 3-9 years since, not to mention new optimizations and features for us to take advantage of and empower our Purebasic abilities :)

wilbert i know that for forcing undocumented or unsupported stuff you can use raw !db bytes in the code instead, for all assemblers i think? as i know you know!
so i went into Hopper seeing as we're both playing with that today heehee...
First go to Main menu -> Preferences, and click "Show Hex Column" to see the raw bytes alongside the disassembly.
And now with any random binary open go to an instruction, and click Modify menu -> Assemble Instruction, and enter your "movq rax, xmm0", and it will assemble it for you to: 66 48 0F 7E C0 :)
not fun though when you just want to program :(

Re: Assembler problems

Posted: Sat Nov 21, 2015 9:11 pm
by wilbert
@Keya, I know using hex bytes is possible but in this case rax and xmm0 is just an example.
I need multiple general purpose registers (r8, r9, r10, r11 and r12) and multiple xmm registers.
It would be very inconvenient to have to use a different byte sequence for each combination of registers.

Re: Assembler problems

Posted: Sat Nov 21, 2015 9:14 pm
by Keya
yes and it's slow-going and ugly code too :( but i think the only workaround besides having fasm updated? fingers crossed!

Re: Assembler problems

Posted: Sat Nov 21, 2015 10:00 pm
by davido
+1 for latest assembler versions.

Re: Assembler problems

Posted: Sun Nov 22, 2015 4:18 pm
by Fred
I will see what can be done.

Re: Assembler problems

Posted: Sun Nov 22, 2015 4:43 pm
by Keya
Thankyou soooo much for looking into it Fred. I think we can all appreciate that if anything major has changed in the assembler itself then it's not going to be just a trivial matter of switching one binary for another! but hopefully it'll be a smooth transition! fingers crossed and best luck :) :) :)

Re: Assembler problems

Posted: Sun Nov 22, 2015 5:11 pm
by wilbert
Fred wrote:I will see what can be done.
Thank you very much :)

Re: Assembler problems

Posted: Tue Nov 24, 2015 7:56 am
by Fred
All updated to lastest versions

Re: Assembler problems

Posted: Tue Nov 24, 2015 8:52 am
by wilbert
That's great !!! :D

Re: Assembler problems

Posted: Tue Nov 24, 2015 9:45 am
by marroh
Fred wrote:All updated to lastest versions
Thank you very much :!:

Re: Assembler problems

Posted: Tue Nov 24, 2015 10:25 am
by Keya
but Christmas isn't until December heehee :) :) :) exciting times, thankyou sooooo much Fred!!!!!!!!

Re: Assembler problems

Posted: Thu Nov 26, 2015 4:44 pm
by ker2x
wilbert wrote: It makes it very difficult to write cross platform code this way that works on all systems.
Cross platform assembly ??? :mrgreen:

Re: Assembler problems

Posted: Thu Nov 26, 2015 5:33 pm
by wilbert
ker2x wrote:
wilbert wrote: It makes it very difficult to write cross platform code this way that works on all systems.
Cross platform assembly ??? :mrgreen:
Yes, cross platform assembly.
Windows, OSX and Linux all use a x86 / x64 processor.
There are some differnces between fasm and yasm/nasm but if you pay attention to those you can write cross platform assembly code.

Re: Assembler problems

Posted: Fri Nov 27, 2015 5:16 pm
by ker2x
only very partially then. Since they have different function call conventions.