By the way, here is the second program I've written in my own programming language:
I really need to stop with that now and start learning for the university!
Code:
;So, this is my second program in my own programming language.
AsmStart
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]
AsmEnd
fib(0):=0
fib(1):=1
i:=2
While i<n+1
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.
i:=i+1
EndWhile
subscript:=(i-1)*4
AsmStart
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-100): ",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 100 dup(?)
section '.idata' data readable import
library msvcrt,'msvcrt.dll'
import msvcrt,printf,'printf',system,'system',exit,'exit',scanf,'scanf'
AsmEnd