Start from a main routine: Difference between revisions

Start from a main routine in XBasic
(Start from a main routine in various BASIC dialents (BASIC256, QBasic, Run BASIC, True BASIC and Yabasic))
(Start from a main routine in XBasic)
Line 703:
Hello from the main function.
</pre>
 
=={{header|XBasic}}==
Applications in XBasic always start from a Sub Main called <code>FUNCTION Entry()</code>.
Nevertheless, to make an application start from a main routine:
* Create a new module called MMain
* Create a new function in the new module as follows:
 
<lang xbasic>FUNCTION main ()
'This is the beginning of the program
END FUNCTION</lang>
 
Press F1 to start the application
<lang xbasic>PROGRAM "Start from a main routine"
 
DECLARE FUNCTION Entry ()
DECLARE FUNCTION main ()
 
FUNCTION Entry ()
main ()
END FUNCTION
 
FUNCTION main ()
PRINT "Hello from main!"
END FUNCTION
 
END PROGRAM</lang>
 
=={{header|Z80 Assembly}}==
This depends entirely on the hardware. WinAPE (an Amstrad CPC emulator) can run a program by typing <code>call &addr</code> where <code>addr</code> is the operand of the <code>org</code> directive at the beginning of the source document.
2,169

edits