Assembler problems

Bare metal programming in PureBasic, for experienced users
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Assembler problems

Post 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 ?
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: Assembler problems

Post 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 :(
Last edited by Keya on Sat Nov 21, 2015 10:01 pm, edited 7 times in total.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Assembler problems

Post 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.
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: Assembler problems

Post by Keya »

yes and it's slow-going and ugly code too :( but i think the only workaround besides having fasm updated? fingers crossed!
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Assembler problems

Post by davido »

+1 for latest assembler versions.
DE AA EB
Fred
Administrator
Administrator
Posts: 16680
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Assembler problems

Post by Fred »

I will see what can be done.
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: Assembler problems

Post 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 :) :) :)
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Assembler problems

Post by wilbert »

Fred wrote:I will see what can be done.
Thank you very much :)
Windows (x64)
Raspberry Pi OS (Arm64)
Fred
Administrator
Administrator
Posts: 16680
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Assembler problems

Post by Fred »

All updated to lastest versions
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Assembler problems

Post by wilbert »

That's great !!! :D
Windows (x64)
Raspberry Pi OS (Arm64)
marroh
User
User
Posts: 72
Joined: Wed Aug 06, 2008 8:21 am

Re: Assembler problems

Post by marroh »

Fred wrote:All updated to lastest versions
Thank you very much :!:
PureBASIC v5.41 LTS , Windows v8.1 x64
Forget UNICODE - Keep it BASIC !
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: Assembler problems

Post by Keya »

but Christmas isn't until December heehee :) :) :) exciting times, thankyou sooooo much Fred!!!!!!!!
ker2x
User
User
Posts: 38
Joined: Sat May 10, 2008 7:52 am
Location: SecondLife

Re: Assembler problems

Post 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:
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Assembler problems

Post 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.
Windows (x64)
Raspberry Pi OS (Arm64)
ker2x
User
User
Posts: 38
Joined: Sat May 10, 2008 7:52 am
Location: SecondLife

Re: Assembler problems

Post by ker2x »

only very partially then. Since they have different function call conventions.
Post Reply