8 Replies - 896 Views - Last Post: 08 May 2017 - 02:06 AM

#1 mohsentux  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 03-May 17

i need a modern cross-platform assembly language...

Posted 03 May 2017 - 08:32 AM

hi I'm completely new to assembly so bear with me as i try to explain my problem:

I'm a cross-platform programmer and just like how c is a cross-platform independent programming language I'm looking for the next best thing that fits the description for Intel 8086 assembly (32 and 64 bit).
from what i understand by researching a little is that: MASM is for windows and can be used with Visual C++. and the exact same thing is true for linux and Nasm.
BUT I'm a cross-platform C++ programmer in need of an assembly language that can be used in conjunction with my code in mac/windows/linux.
is there such an option? remember I'm a newb so bear with me if i sound ignorant i haven't even picked my assembly language yet.
but it needs to support modern assembly ( such as SSE and AVX et cetera ).

so please share your knowledge and experience with me so i can become an assembly programmer. thanksperform

Is This A Good Question/Topic? 0
  • +

Replies To: i need a modern cross-platform assembly language...

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13491
  • View blog
  • Posts: 53,887
  • Joined: 12-June 08

Re: i need a modern cross-platform assembly language...

Posted 03 May 2017 - 08:35 AM

Why do you need Assembly to be cross platform?

Remind you assembly at large is processor specific.
Was This Post Helpful? 0
  • +
  • -

#3 mohsentux  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 03-May 17

Re: i need a modern cross-platform assembly language...

Posted 03 May 2017 - 08:45 AM

View Postmodi123_1, on 03 May 2017 - 08:35 AM, said:

Why do you need Assembly to be cross platform?

Remind you assembly at large is processor specific.


I'll only use new intel and amd cpus so I'll be using 8086. when i said cross-platform i meant operating systems . i basically meant writing the assembly code once for every OS ( macOS, windows, linux eg..) which all use the same cpu architecture.
Was This Post Helpful? 0
  • +
  • -

#4 GunnerInc  Icon User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 917
  • View blog
  • Posts: 2,358
  • Joined: 28-March 11

Re: i need a modern cross-platform assembly language...

Posted 03 May 2017 - 08:58 AM

No, you cannot do that. Each OS has its own API, so you will need to write different code for each OS. Even the ABI is different for each OS. Windows has its own API, and the ABI is different between 32 and 64 bit. Linux has its own syscall numbers as does Mac.
Was This Post Helpful? 2
  • +
  • -

#5 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13491
  • View blog
  • Posts: 53,887
  • Joined: 12-June 08

Re: i need a modern cross-platform assembly language...

Posted 03 May 2017 - 08:59 AM

Well.. that's most likely not going to happen. While the syntax may be close OS interaction, cpus etc. screw with cross-platform.
Was This Post Helpful? 0
  • +
  • -

#6 mohsentux  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 03-May 17

Re: i need a modern cross-platform assembly language...

Posted 03 May 2017 - 09:07 AM

so what you're saying is cross-platform code for assembly is not a possibility... i see
so MASM for windows
NASM for Linux
what can fasm do they say it doesn't need a linker and it's independent and powerful.
Was This Post Helpful? 0
  • +
  • -

#7 Salem_c  Icon User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 2130
  • View blog
  • Posts: 4,196
  • Joined: 30-May 10

Re: i need a modern cross-platform assembly language...

Posted 03 May 2017 - 09:21 AM

Nasm is portable in the sense that it runs on several platforms, so at least you only have one tool to learn.
http://www.nasm.us/p...asebuilds/2.13/

If you're restricting yourself to x86, then the code you write will be portable-ish, so long as you don't try to call the underlying OS (as noted above). It might take a bit of pre-processing magic to make it all line up just nice though.
Was This Post Helpful? 0
  • +
  • -

#8 no2pencil  Icon User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6552
  • View blog
  • Posts: 30,682
  • Joined: 10-May 07

Re: i need a modern cross-platform assembly language...

Posted 03 May 2017 - 10:32 AM

The binary output files are different for each OS, & there will be unique calls between the two. For example, INT80 returns to the kernel in Linux, & this is not a thing in Windows.

You could probably write two sets of code files, & then check which OS you are assembling on to generate the correct binary type. But there is no automated : Click go & this works for everyone! utopia.
Was This Post Helpful? 0
  • +
  • -

#9 mohsentux  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 03-May 17

Re: i need a modern cross-platform assembly language...

Posted 08 May 2017 - 02:06 AM

this topic is a bit old but i found the solution to the problem so I'll post it here in case someone else searched for the same thing.

the answer is use Intrinsics
this way you can optimize your code and don't use an assembly language.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1