Not having delved into FreeBasic before, and having just done a quick overview, I am very impressed with what I've read. Undoubtedly, many people are going to be happier with PowerBasic because it Integrated Development Editor gives you the ability to compile and run a program, as well as debug it on the fly, and those are mighty inducements to its continued use. But from what I've read thus far, there is much to like about FreeBasic as well.
Now since this thread is intended to focus some added attention on the use of
the Inline Assembler, it might be of value to look at some of the extracts from the
online FreeBasic manual (the link was provided above):
Syntax
The syntax of the inline assembler is a simplified form of Intel syntax. Intel syntax is used by the majority of x86 assemblers, such as MASM, TASM, NASM, YASM and FASM. In general, the destination of an instruction is placed first, followed by the source. Variables and functions defined by a program may be referenced in an Asm block. The assembler used by FreeBASIC is GAS, using the .intel_syntax noprefix directive, and ASM blocks are passed through unmodified, except for the substitution of local variable names for stack frame references, and commenting removal.
Register Preservation
When an ASM block is opened, the registers ebx, esi, and edi are pushed to the stack, when the block is closed, these registers are popped back from the stack. This is because these registers are required to be preserved by most or all OS's using the x86 CPU. You can therefore use these registers without explicitly preserving them yourself.
Register Names
The names of the registers for the x86 architecture are written as follows in an Asm block:
# 4-byte integer registers: eax, ebx, ecx, edx, ebp, esp, edi, esi
# 2-byte integer registers: ax, bx, cx, dx, bp, sp, di, si (low words of 4-byte e- registers)
# 1-byte integer registers: al, ah, bl, bh, cl, ch, dl, dh (low and high bytes of 2-byte -x registers)
# Floating-point registers: st(0), st(1), st(2), st(3), st(4), st(5), st(6), st(7)
# MMX registers (aliased onto floating-point registers): mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7
# SSE registers: xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7
'' This is an example for the x86 architecture.
Function AddFive(Byval num As Integer) As Integer
ASM
mov eax, [num]
add eax, 5
mov [Function], eax
End ASM
End Function
Note that both FreeBasic and PowerBasic automatically same the same
registers and restore them for you. Also note that you can lead each assembly
instruction line with ASM for both compilers, or you can use the exclamation
mark as an alternative in PowerBasic, but only FreeBasic provides the use of an
ASM block as shown above. Another difference is that both compilers support
the use of the keyword FUNCTION for returning a value, but FreeBasic wants it
in a square bracket. Further, FreeBasic's inline assembler is case sensitive when
it comes to lables, and PowerBasic is not.