Here is an example output of the command-line tool:
;Generated by Arithmetic Expression Compiler (http://flatassembler.000webhostapp.com/compiler.html) run in Duktape.
;;So, this is my second program in my own programming language.
;Inline assembly begins.
debug=0
format PE console
entry start
include 'win32a.inc'
section '.text' code executable
start:
mov dword [esp],_output1
call [printf]
mov dword [esp+4],n
mov dword [esp],_input1
call [scanf]
;Inline assembly ended.
;fib(0):=0
finit
mov dword [result],0x0 ;0
fld dword [result]
fstp dword [result]
push dword [result]
mov dword [result],0x0 ;0
fld dword [result]
fistp dword [result]
mov ebx,[result]
pop dword [fib+4*ebx]
;fib(1):=1
finit
mov dword [result],0x3F800000 ;1
fld dword [result]
fstp dword [result]
push dword [result]
mov dword [result],0x3F800000 ;1
fld dword [result]
fistp dword [result]
mov ebx,[result]
pop dword [fib+4*ebx]
;i:=2
finit
mov dword [result],0x40000000 ;2
fld dword [result]
fstp dword [result]
push dword [result]
pop dword [i]
;While i<n+1
finit
l379056:
fld dword [n]
mov dword [result],0x3F800000 ;1
fld dword [result]
faddp st1,st0
fld dword [i]
fxch
fcomip st1
fstp dword [result]
jna l884416
fld1
jmp l552240
l884416:
fldz
l552240:
fistp dword [result]
mov eax,[result]
test eax,eax
je l409817
;fib(i):=fib(i-1)+fib(i-2) ;Good idea, QBASIC! Treating Assembly arrays as functions, I would have never thought of that! It's really easy to program.
finit
fld dword [i]
mov dword [result],0x3F800000 ;1
fld dword [result]
fsubp st1,st0
fistp dword [result]
mov ebx,[result]
fld dword [fib+4*ebx] ;In case the program is supposed to be 16-bit, simply replace 'ebx' with 'bx'. In case it's 64-bit, replace the 'mov' in the last directive with 'movsx' and 'ebx' with 'rbx' in both this and the last directive.
fld dword [i]
mov dword [result],0x40000000 ;2
fld dword [result]
fsubp st1,st0
fistp dword [result]
mov ebx,[result]
fld dword [fib+4*ebx] ;In case the program is supposed to be 16-bit, simply replace 'ebx' with 'bx'. In case it's 64-bit, replace the 'mov' in the last directive with 'movsx' and 'ebx' with 'rbx' in both this and the last directive.
faddp st1,st0
fstp dword [result]
push dword [result]
fld dword [i]
fistp dword [result]
mov ebx,[result]
pop dword [fib+4*ebx]
;i:=i+1
finit
fld dword [i]
mov dword [result],0x3F800000 ;1
fld dword [result]
faddp st1,st0
fstp dword [result]
push dword [result]
pop dword [i]
;EndWhile
finit
jmp l379056
l409817:
;subscript:=(i-1)*4
finit
fld dword [i]
mov dword [result],0x3F800000 ;1
fld dword [result]
fsubp st1,st0
mov dword [result],0x40800000 ;4
fld dword [result]
fmulp st1,st0
fstp dword [result]
push dword [result]
pop dword [subscript]
;Inline assembly begins.
fld dword [subscript]
fistp dword [subscript]
mov ebx,[subscript]
fld dword [fib+ebx]
fstp qword [esp+4]
mov dword [esp],_output2
call [printf]
mov dword [esp],_pause
call [system]
mov dword [esp],0
call [exit]
_output1 db "Enter n (0-50): ",0
_output2 db "The n-th Fibonacci number is: %f",10,0
_input1 db "%f",0
_pause db "PAUSE",0
section '.rdata' readable writable
result dd ? ;Yes, you need to declare it to be used internally by AEC. Hope you don't mind! :-)
n dd ?
i dd ?
subscript dd ?
fib dd 50 dup(?)
section '.idata' data readable import
library msvcrt,'msvcrt.dll'
import msvcrt,printf,'printf',system,'system',exit,'exit',scanf,'scanf'
;Inline assembly ended.
So, what do you get when you try to assemble it using NASM?