Cross-Platform Assembly Language?

  • (2 Pages)
  • +
  • 1
  • 2

27 Replies - 18393 Views - Last Post: 04 February 2019 - 05:04 AM

#1 C++ Programmer   User is offline

  • D.I.C Addict
  • member icon

Reputation: 20
  • View blog
  • Posts: 548
  • Joined: 12-June 08

Cross-Platform Assembly Language?

Posted 14 February 2011 - 01:50 PM

I know that Assembly languages are NOT cross-platform and are different for every architecture.

My question is, why does someone not make a cross-platform language that has a syntax similar to most assemblers? The reason I'm asking is, I enjoy programming in NASM (Windows) but I also have Linux (Ubuntu) and I hate having to change my code to assemble on each different platform. Programming in Assembly is fun for me because it is more challenging to accomplish simple tasks, and challenges are always fun, but the re writing of the code is a real turn off for me.

What do you guys think and is there a language like that, that I don't know about?

Is This A Good Question/Topic? 1
  • +

Replies To: Cross-Platform Assembly Language?

#2 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12530
  • View blog
  • Posts: 45,662
  • Joined: 27-December 08

Re: Cross-Platform Assembly Language?

Posted 14 February 2011 - 02:05 PM

Moved to Assembly.
Was This Post Helpful? 0
  • +
  • -

#3 C++ Programmer   User is offline

  • D.I.C Addict
  • member icon

Reputation: 20
  • View blog
  • Posts: 548
  • Joined: 12-June 08

Re: Cross-Platform Assembly Language?

Posted 14 February 2011 - 02:09 PM

Thank you. I saw the sub forum after I posted this topic. Sorry.
Was This Post Helpful? 0
  • +
  • -

#4 Guest_Hornet*


Reputation:

Re: Cross-Platform Assembly Language?

Posted 15 February 2011 - 10:59 PM

It's an interesting concept, not of unheard of and not really that difficult to implement. Assembly language is processor specific more so then OS specific (the instructions don't change from linux to windows, assuming the same processor/mode, but the order and way they're used in does). So if you want to make a cross-compatible application you're basically just doubling your code (maybe not quite if done efficiently). It's not difficult, first you determine what OS the application is being executed on, then you use the same base routines but every time you call an api you determine which api to call dependent on the OS the application is being run on.

The file format can be a difficult thing for OS's to agree on, so you have to determine a neutral file format that loads equally well on each OS. More specifically there's a reason most drivers/applications/etc. have seperate files for each operating system. You more so want to combine the two to create a neutral format, which isn't really declared yet (hoping for a new ISO cross-platform file format shortly).

Best of luck, just make sure to know the differences in operating systems.
Was This Post Helpful? 0

#5 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6734
  • View blog
  • Posts: 31,197
  • Joined: 10-May 07

Re: Cross-Platform Assembly Language?

Posted 15 February 2011 - 11:11 PM

My understanding is that Nasm was build to be a universal assembler language, & was named netwide assembler as such. The problem isn't syntax, it's availability. You are going to have different interups for different operating systems, & different registers for different processors.
Was This Post Helpful? 0
  • +
  • -

#6 nathanpc   User is offline

  • SCIENCE!
  • member icon

Reputation: 113
  • View blog
  • Posts: 1,171
  • Joined: 31-July 09

Re: Cross-Platform Assembly Language?

Posted 19 March 2011 - 07:33 PM

Assembly isn't a platform-specific language, you just need a cross-platform assembler like Nasm or Fasm, but always remember that Assembly is a processor-specific language, so if your code was written to run on a x86 chip, it won't be the same for ARM.

If you want to port your Assembly code from one processor to another, just make a Google search for comparisons with the processor that you used and the one that you want your code to run.
Was This Post Helpful? 0
  • +
  • -

#7 ishkabible   User is offline

  • spelling expret
  • member icon





Reputation: 1747
  • View blog
  • Posts: 5,898
  • Joined: 03-August 09

Re: Cross-Platform Assembly Language?

Posted 21 March 2011 - 10:23 AM

ya but the code it's self is the issue not the assembler. even if you can use clib functions in a uniform way you still have to import those in a non-uniform way. if an assembler where to allow for some type of pre-proc then it would be a step in the right direction.
Was This Post Helpful? 0
  • +
  • -

#8 C++ Programmer   User is offline

  • D.I.C Addict
  • member icon

Reputation: 20
  • View blog
  • Posts: 548
  • Joined: 12-June 08

Re: Cross-Platform Assembly Language?

Posted 31 May 2011 - 10:25 AM

Why does someone not make a language that runs off of...let's say the JVM, but has the syntax of an assembler. I like coding in ASM because it is challenging to make things work, but I don't like the fact I have to rewrite my code for each system.
Was This Post Helpful? 0
  • +
  • -

#9 Bellum   User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 53
  • Joined: 04-February 09

Re: Cross-Platform Assembly Language?

Posted 07 June 2011 - 05:01 PM

I used to play a game called Noctis, and the developer (Alessandro Ghignola) was a low level guy who preferred assembly and was developing a crossplatform assembly language. I've never tried it, but I've heard a lot of people say they liked it. It's called L.In.O.L.E.U.M and can be found on his website.

This post has been edited by Bellum: 07 June 2011 - 05:01 PM

Was This Post Helpful? 0
  • +
  • -

#10 ishkabible   User is offline

  • spelling expret
  • member icon





Reputation: 1747
  • View blog
  • Posts: 5,898
  • Joined: 03-August 09

Re: Cross-Platform Assembly Language?

Posted 08 June 2011 - 07:15 PM

Quote

crossplatform assembly language

maybe an intermediate representation but not cross platform assembly.
Was This Post Helpful? 0
  • +
  • -

#11 GunnerInc   User is offline

  • "Hurry up and wait"
  • member icon




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

Re: Cross-Platform Assembly Language?

Posted 10 June 2011 - 07:27 PM

View Postishkabible, on 21 March 2011 - 01:23 PM, said:

ya but the code it's self is the issue not the assembler. even if you can use clib functions in a uniform way you still have to import those in a non-uniform way. if an assembler where to allow for some type of pre-proc then it would be a step in the right direction.


Wouldn't a pre-proc be a HUGE undertaking? It would have to know what/how to convert the system calls/API's to each platforms version. Which ones changed and how. Basically map one API/system call to another right? I'd say leave well enough alone (Assembly), leave it up to the developer to write the code for each platform since they are all soooo different, or just use C/C++ or some other HLL. People are always wanting to change Asm and make it easier... Nah, simplicity of it is the best.
Was This Post Helpful? 0
  • +
  • -

#12 ishkabible   User is offline

  • spelling expret
  • member icon





Reputation: 1747
  • View blog
  • Posts: 5,898
  • Joined: 03-August 09

Re: Cross-Platform Assembly Language?

Posted 15 June 2011 - 06:47 PM

wrong, it would simply define things for each different system and you would include them in a corresponding manner. just like how it works in C and C++ but with binary's instead of headers. NASM is already pretty close to uniform, the file which contains the clib functions is really what gets people.

something like this

#ifdef WIN32
   import printf from msvcrt.dll
#elseifdef LINUX
   import printf from runtimelib.so
#end



i don't know that the runtime lib is for Linux but you get he idea

This post has been edited by ishkabible: 15 June 2011 - 06:53 PM

Was This Post Helpful? 0
  • +
  • -

#13 GWatt   User is offline

  • member icon

Reputation: 309
  • View blog
  • Posts: 3,105
  • Joined: 01-December 05

Re: Cross-Platform Assembly Language?

Posted 15 June 2011 - 09:29 PM

Discovering where system calls/stdlib functions exist isn't the job of the assembler. That's the job of the linker. What is going to be an issue for system independent assembly is the various calling conventions. A calling convention is the way functions pass arguments to each other. Sometimes the arguments might be put in r0-rX. Maybe they're stored on the stack. Maybe they're stored on a different stack reserved entirely for function parameters. Maybe there are different calling conventions used in the same system. These are the important things to worry about when hand coding assembly. In order for a platform independent assembly to work you need to have a way to translate from the universal assembly to each specific platform you wish to support. Also, binary files don't tell you what the calling convention is. This requires some extra information like a header file. At some point this will stop being an assembler and become a compiler for some bastard child of C and assembly with the advantages of neither and the cross platform capabilities of a crippled Java implementation.
Was This Post Helpful? 0
  • +
  • -

#14 ishkabible   User is offline

  • spelling expret
  • member icon





Reputation: 1747
  • View blog
  • Posts: 5,898
  • Joined: 03-August 09

Re: Cross-Platform Assembly Language?

Posted 19 June 2011 - 03:30 PM

a pre-proc still handles all of that, also most assemblers have a syntax for importing .dlls rather than importing them via command line options so it doesn't matter what piece of software ends up doing it, the notation is still the same.

the pre-proc doesn't take care of calling convention but if you are writing cross platform functions you would write each function differently, in writing these functions you, the writer, would take care of the calling convention, not the assembler.

This post has been edited by ishkabible: 19 June 2011 - 03:33 PM

Was This Post Helpful? 0
  • +
  • -

#15 GWatt   User is offline

  • member icon

Reputation: 309
  • View blog
  • Posts: 3,105
  • Joined: 01-December 05

Re: Cross-Platform Assembly Language?

Posted 19 June 2011 - 10:28 PM

If you have to write the same function different ways for each platform then you don't really have a cross platform assembly language. Sure, you can use an assembler that works on multiple platforms, but that doesn't magically make your code cross platform.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2