User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Inline Assembly in FreeBASIC?

Tue Sep 27, 2016 3:47 am

I am playing with FreeBASIC, as it is similar to many of the Compiled BASIC's that I am familiar with.

Though I can not find any information for the required syntax for inline ARM assembly. I can find references to the use of ASM SUBs and FUNCTIONS, and a lot about the x86 assembler syntax in FreeBASIC, though not a word about the ARM assembly syntax.

So does anyone know the requirements for inline ARM assembly in FreeBASIC?



I am thinking that I am liking FreeBASIC, quite a bit. It is not as optimal as C compiled with GCC, though it seems to be a good language none the less, and it has a lot of things defined by the language that are the same on all platforms that no extended C can offer with the same market saturation as FreeBASIC, like the FreeBASIC Graphics library (largely based on and extended from QB, meaning that there is a lot of usable QB code out there for FreeBASIC to take advantage of).

Think about it this way:
This may not be a standard, though it is a good language, that is cross-platform, has enough market saturation that it may as well be a standard, and it supports Mouse functions as part of its core language, as well as some pretty amaizing graphics operations as part of the core language (off screen buffers, XOR/OR/AND/Alpha/PUT/etc operations on block copies/moves [almost Amiga blitter like abilities] with only the core standard FreeBASIC graphics). and a very powerful core language, that is structured and modern.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

Heater
Posts: 12969
Joined: Tue Jul 17, 2012 3:02 pm

Re: Inline Assembly in FreeBASIC?

Tue Sep 27, 2016 4:17 am

Does the discussion of using ARM assembler in FreeBASIC here help:
http://www.freebasic.net/forum/viewtopic.php?t=21433 ?

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Inline Assembly in FreeBASIC?

Tue Sep 27, 2016 4:38 am

Heater wrote:Does the discussion of using ARM assembler in FreeBASIC here help:
http://www.freebasic.net/forum/viewtopic.php?t=21433 ?
Unfortunately no. That thread only mentions how to link in assembly that is written seperately. I am looking for the required syntax of ARM Assembly for Inline usage in FreeBASIC.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

User avatar
paulwratt
Posts: 83
Joined: Fri Jun 12, 2015 12:15 am

Re: Inline Assembly in FreeBASIC?

Wed Dec 07, 2016 10:47 am

there is a possibility that it is not supported, due to its x86 roots..

..however, FBC uses GCC to compile, so the inline (x86) must be converted to AS assembler. I know there have been a few changes in recent years, but they are related to how to get vars into and out of AS, not the assembler language itself.

If your using a late-model GCC it can convert x86 assembler on ARM at compile time (within reason)

So without doing any Google-ing I would suggest refering to either x86 GAS or ARM GAS, and see what you get. (GAS=Gnu AS)

If I am completely wrong here (cos I aint got it set up to test yet), check what the inline x86 assembler reference src style is. It will be either GAS, NASM, or MASM style. Note there is a version of NASM (Netwide ASseMbler) for ARM, and from memory NASM & MASM are interchangeable (maybe with NASM switch)

It is prossible that, like many things that have inline assembler, FBC does not check the contents, presumes its syntactically correct, and just adds the the proper ASM wrapper, in which case placing ARM assembler in an inline x86 block in FB code will work..

Paul

Return to “Other programming languages”