Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Basic Compiler > Re: PureBasic /...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 4 Topic 145 of 152
Post > Topic >>

Re: PureBasic / PowerBASIC / FreeBasic Inline ASM comparison

by Guy Macon <http://www.guymacon.com/> Feb 14, 2008 at 02:48 PM

H-Man wrote:

>Optimus Prime wrote:
>
>> "H-Man <I-Hate@[EMAIL PROTECTED]
> says...
>> 
>>>For a viable alternative you might consider PureBasic. It's my
>>>language of choice for right now. Small and really tight executables, 
>>>Linux and MAC versions, GUI designer, console progs and DLLs. Inline 
>>>ASM, and a >>>library compiler rounds out the offerings. It really is 
>>>a lot of >>>development tool for the money. The PureBasic community 
>>>is very knowledgeable and very helpful, and AFAIK no one has been 
>>>axed from the forums. PureBasic has been around since 1998 and has 
>>>a strong following. Nothing is forever but it looks to remain for 
>>>a while. Please don't misunderstand, I'm not dissing PowerBASIC or 
>>>the products thereof, the reputation of these products speaks for 
>>>itself, I am however advocating PureBasic as a worthy alternative. 
>> 
>> Does the PureBasic inline ASM sup****t extended instructions such 
>> as SSE3 and AMD64 / EM64T?
>
>From the PureBasic docs:
>
>PureBasic allows you to include any x86 assembler commands (including MMX
>and FPU one) directly in the source code, as if it was a real assembler.
>And it gives you even more: you can use directly any variables or
pointers
>in the assembler keywords, you can put any ASM commands on the same line,
>... The syntax is the FAsm (http://flatassembler.net)
one, so if you want
>more informations about the ASM syntax, just read the FAsm guide. 
>
>There are several ways to activate the inline assembler: 
>
>- check the "inline assembler" compiler option via the IDE 
>- use the /INLINEASM command line compiler switch 
>- use the compiler directives EnableASM and DisableASM 
>
>It does sup****t anything FAsm sup****ts although I'm not sure how much
good
>it'll do you to include x86-64 instructions in a 32bit program. That is
for
>people way smarter than I am. I mostly cut and paste ASM when I need an
>optimized routine for speed.

The Flat Assembler docs explain how to work with the 
various extended instructions:

From [ http://flatassembler.net/docs.php?article=manual
]:

Chapter 2 - Instruction Set
2.1 The x86 architecture instructions
2.1.1 Data movement instructions
2.1.2 Type conversion instructions
2.1.3 Binary arithmetic instructions
2.1.4 Decimal arithmetic instructions
2.1.5 Logical instructions
2.1.6 Control transfer instructions
2.1.7 I/O instructions
2.1.8 Strings operations
2.1.9 Flag control instructions
2.1.10 Conditional operations
2.1.11 Miscellaneous instructions
2.1.12 System instructions
2.1.13 FPU instructions
2.1.14 MMX instructions
2.1.15 SSE instructions
2.1.16 SSE2 instructions
2.1.17 SSE3 instructions
2.1.18 AMD 3DNow! instructions
2.1.19 The x86-64 long mode instructions

I looked the above over, and it looks like it will do everything 
you are looking for.  An additional advantage is that you can
easily go from inline assembly to 100% assembly language without
having to re-learn everything.

I also noted that PureBasic has a console mode, which is an 
im****tant feature for the kinds of things I do, such as writing 
a program that controls an automated assembly line with the only
user interface being a simple status screen.

There are some PureBasic limitations that may bother some folks; 
http://www.purebasic.com/do***entation/reference/variables.html
says that PureBasic sup****ts the following data types:

         Byte |  8 bit signed fixed   | -128 to +127
    Character |  8 bit                |  65,535 different characters
Unicode Char. | 16 bit                |  255 different characters
         Word | 16 bit signed fixed   | -32,768 to +32,767
         Long | 32 bit signed fixed   | -2,147,483,648 to +2,147,483,647
         Quad | 64 bit signed fixed   | -9.22x10^18 to +9.22x10^18
        Float | 32 bit IEEE 754 float |  8.43x10^-37 to 3.40x10^38
       Double | 64 bit IEEE 754 float |  4.19x10^-307 to 1.79x10^308
       String |
 Fixed String |

Unless the above URL is wrong, notably lacking are: 
  
 8 bit unsigned fixed | 0 to 255
16 bit unsigned fixed | 0 to 65,535
32 bit unsigned fixed | 0 to 4,294,967,295
80 bit IEEE 754 float | 3.4x10^-4932 to 1.2x10^4932
Currency              | -9.22x10^14 to +9.22x10^14
Extended-currency     | -9.22x10^16 to +9.22x10^16

All of which are available in PowerBASIC, along with more
exotic data types such as Variants and GIUDs.


PowerBASIC, on the other hand, is far more limited in what 
you can do with inline assembly.  As do***ented in
http://www.powerbasic.com/sup****t/help/pbcc/asm_statement.htm
"PowerBASIC's Inline Assembler sup****ts 8086/8088, 80286, 80386, 
80486, Pentium, Floating-Point and MMX instructions."  I don't
see any sup****t for SSE of any kind.


FreeBASIC uses GAS/AS (the GCC assembler).

The newest version of the AS/GAS manual I could find (2002) says:

 8.12.9 Intel's MMX and AMD's 3DNow! SIMD Operations
 as' sup****ts Intel's MMX instruction set (SIMD instructions 
 for integer data), available on Intel's Pentium MMX processors 
 and Pentium II processors, AMD's K6 and K6-2 processors, Cyrix' 
 M2 processor, and probably others.  It also sup****ts AMD's 3DNow!  
 instruction set (SIMD instructions for 32-bit floating point data) 
 available on AMD's K6-2 processor and possibly others in the 
 future.   Currently, `as' does not sup****t Intel's floating point 
 SIMD, Katmai (KNI). [Later renamed SSE].

So no SSE/SSE2/SSE3 for FreeBASIC users... :(

One really interesting feature of FreeBASIC is that it is written 
in FreeBASIC.  This means that a BASIC programmer can extend the
language. fix bugs, and in general participate in the Open Source
development process without having to use C.

My wish list includes a BASIC compiler that lets me enter x86 
System Management Mode using inline assembly.  <grin> 






--  
Guy Macon <http://www.guymacon.com/>
Guy Macon <http://www.guymacon.com/>
Guy Macon <http://www.guymacon.com/>
Guy Macon <http://www.guymacon.com/>
Guy Macon <http://www.guymacon.com/>
Guy Macon <http://www.guymacon.com/>
Guy Macon <http://www.guymacon.com/>
Guy Macon <http://www.guymacon.com/>
 




 4 Posts in Topic:
PureBasic / PowerBASIC / FreeBasic Inline ASM comparison
Optimus Prime <optimus  2008-02-13 12:44:16 
Re: PureBasic / PowerBASIC / FreeBasic Inline ASM comparison
H-Man <I-Hate@[EMAIL P  2008-02-13 14:36:22 
Re: PureBasic / PowerBASIC / FreeBasic Inline ASM comparison
Guy Macon <http://www.  2008-02-14 14:48:21 
Re: PureBasic / PowerBASIC / FreeBasic Inline ASM comparison
H-Man <I-Hate@[EMAIL P  2008-02-13 14:47:51 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 7 12:52:47 CDT 2008.