Is anyone using freebasic as a macro assembler?
Is anyone using freebasic as a macro assembler?
Freebasic with inline asm sounds as a masm alternative, am I right?
-
- Posts: 35
- Joined: Jun 09, 2024 18:26
Re: Is anyone using freebasic as a macro assembler?
No.
For one example...
Code: Select all
DIM i AS INTEGER
FOR i = 0 TO 99
ASM
nop
END ASM
NEXT i
Neither specifying -funroll-all-loops to gcc will produce the desired outcome.
Re: Is anyone using freebasic as a macro assembler?
So it is something fixable in Freebasic.
-
- Posts: 35
- Joined: Jun 09, 2024 18:26
Re: Is anyone using freebasic as a macro assembler?
Fixable?
I think that would turn FreeBASIC into something akin to an Acorn/BBC BASIC with it's inbuilt assembler, is that what you are thinking?
If so, just use BBCSDL/BB4W.
You can always include GAS directives (.rept & .endr) for example into the assembly block thus...
This would produce the correct/desired output that my first "example" wouldn't by using GAS to do the inlining.
Or, for example...
I think that would turn FreeBASIC into something akin to an Acorn/BBC BASIC with it's inbuilt assembler, is that what you are thinking?
If so, just use BBCSDL/BB4W.
You can always include GAS directives (.rept & .endr) for example into the assembly block thus...
This would produce the correct/desired output that my first "example" wouldn't by using GAS to do the inlining.
Code: Select all
ASM
.rept 100
nop
.endr
END ASM
END
Or, for example...
Code: Select all
DIM a AS INTEGER
a = 0
ASM
.rept 100
mov rax,[a]
add rax,69
mov [a],rax
.endr
END ASM
PRINT a
END
-
- Posts: 3955
- Joined: Jan 01, 2009 7:03
- Location: Australia
Re: Is anyone using freebasic as a macro assembler?
Just received these error message 100 times,
C:\FreeBASIC_CODE\ASM_ADD.asm: Assembler messages:
C:\FreeBASIC_CODE\ASM_ADD.asm:28: Error: too many memory references for `mov'
C:\FreeBASIC_CODEt\ASM_ADD.asm:28: Error: ambiguous operand size for `add'
The word "add" is reserved?
Put [ target, ] [ STEP ] ( x,y ), source [ ,( x1,y1 )-( x2,y2 ) ], Add[ ,multiplier ]
C:\FreeBASIC_CODE\ASM_ADD.asm: Assembler messages:
C:\FreeBASIC_CODE\ASM_ADD.asm:28: Error: too many memory references for `mov'
C:\FreeBASIC_CODEt\ASM_ADD.asm:28: Error: ambiguous operand size for `add'
The word "add" is reserved?
Put [ target, ] [ STEP ] ( x,y ), source [ ,( x1,y1 )-( x2,y2 ) ], Add[ ,multiplier ]
-
- Posts: 35
- Joined: Jun 09, 2024 18:26
Re: Is anyone using freebasic as a macro assembler?
Sorry, I'm unable to help regarding Windows (mingw) builds of FreeBASIC.BasicCoder2 wrote: ↑Mar 29, 2025 17:32 Just received these error message 100 times,
C:\FreeBASIC_CODE\ASM_ADD.asm: Assembler messages:
C:\FreeBASIC_CODE\ASM_ADD.asm:28: Error: too many memory references for `mov'
C:\FreeBASIC_CODEt\ASM_ADD.asm:28: Error: ambiguous operand size for `add'
The word "add" is reserved?
Put [ target, ] [ STEP ] ( x,y ), source [ ,( x1,y1 )-( x2,y2 ) ], Add[ ,multiplier ]
Just for the record, the above code is Linux x86_64 tested only in its current state. For 32bit the registers and maybe pointer sizes will need changing/prefixing.
Again, sorry!
Re: Is anyone using freebasic as a macro assembler?
RetardedAndProud wrote: ↑Mar 29, 2025 14:38 Fixable?
I think that would turn FreeBASIC into something akin to an Acorn/BBC BASIC with it's inbuilt assembler, is that what you are thinking?
If so, just use BBCSDL/BB4W.
BBC BASIC is not open source and it is interpreted.