TempleOSTS_140317.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:46:02 +02:00
1 parent 2d2a65d572
commit 7ef616a20e
1416 files changed
+223873 -53917

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
import U0 Print(U8 *fmt,...);
U0 Routine1(U8 *st)
{
"Routine1:%s\n",st;
}
+6
View File
@@ -0,0 +1,6 @@
U0 Routine2(U8 *st)
{
"Routine2:%s\n",st;
}
+28
View File
@@ -0,0 +1,28 @@
import U0 Print(U8 *fmt,...);
U0 Routine3(U8 *st)
{
"Routine3:%s\n",st;
}
//Any routine with var parameters
//automatically has vars argc and argv[]
//whether it is main or not.
I64 ModuleDemo(...)
{
I64 i;
if (argc>0) {
for (i=0;i<argc;i++)
"Arg %d:%08X\n",i,argv[i];
Routine1(argv[0]);
if (argc>1) {
Routine2(argv[1]);
if (argc>2)
Routine3(argv[2]);
}
} else
"Pass string parameters for args 1 and 2.\n";
return argc;
}
@@ -0,0 +1 @@
extern I64 ModuleDemo(...);
@@ -0,0 +1,10 @@
// imports all syms from the Adam Task's hash table.
#include "::/Kernel/AOT.HPP"
#exe {Cd("::/Demo/OldSchool/MultiFileAOT");};
#include "MD1"
#include "MD2"
#include "MDMain"
+13
View File
@@ -0,0 +1,13 @@
1) Do a $LK,"Dir",A="MN:Dir"$() command
2) Right-Click on ModuleDemo.PRJ.Z and click $FG,2$AOT COMPILE$FG$.
3) Do a $LK,"Dir",A="MN:Dir"$() command
4) Right-Click on ModuleDemo.BIN.Z and click $FG,2$LOAD$FG$.
5) Right-Click on ModuleDemo.HPP.Z and click $FG,2$INCLUDE$FG$.
6) Type at the command-line:
$ID,2$$FG,2$>ModuleDemo("Arg1","Arg2");
$ID,-2$
+24
View File
@@ -0,0 +1,24 @@
Cd("::/Demo/OldSchool/MultiModAOT");;
Cmp("OD1");
Cmp("OD2");
Cmp("ODMain");
Load("OD1");
Load("OD2");
Load("ODMain");
#include "ObjDemo.HPP"
ObjDemo("Success");
#ifndef BinRep
#include "::/Adam/Utils/BinRep"
#endif
PressAKey;
BinRep("OD2");
PressAKey;
BinRep("ODMain");
PressAKey;
Who("-r");
+12
View File
@@ -0,0 +1,12 @@
// imports all syms from the Adam Task's hash table.
#include "::/Kernel/AOT.HPP"
import U0 Routine3(U8 *st);
U0 Routine1(U8 *st)
{
"Routine1:%s\n",st;
Routine3("What the!!!");
}
+32
View File
@@ -0,0 +1,32 @@
// imports all syms from the Adam Task's hash table.
#include "::/Kernel/AOT.HPP"
asm {
USE64
IMPORT Beep;
_MY_BEEP::
PUSH RBP
MOV RBP,RSP
PUSH FALSE
PUSH 300
CALL Beep
POP RBP
RET
}
_extern _MY_BEEP U0 MyBeep();
U0 Routine2(U8 *st)
{
"Routine2:%s\n",st;
MyBeep();
}
"$$BK,1$$Woo-Hoo!$$BK,0$$\n";
Dir;
"$$BK,1$$Woo-Hoo!$$BK,0$$\n";
Routine2("Cool");
+34
View File
@@ -0,0 +1,34 @@
// imports all syms from the Adam Task's hash table.
#include "::/Kernel/AOT.HPP"
import U0 Routine1(U8 *st);
import U0 Routine2(U8 *st);
_import _MY_BEEP U0 MyBeep();
U0 Routine3(U8 *st)
{
"Routine3:%s\n",st;
}
//Any routine with var parameters
//automatically has vars argc and argv[]
//whether it is main or not.
I64 ObjDemo(...)
{
I64 i;
MyBeep();
if (argc>0) {
for (i=0;i<argc;i++)
"Arg %d:%08X\n",i,argv[i];
Routine1(argv[0]);
if (argc>1) {
Routine2(argv[1]);
if (argc>2)
Routine3(argv[2]);
}
} else
"Pass string parameters for args 1 and 2.\n";
return argc;
}
+11
View File
@@ -0,0 +1,11 @@
//This file ties SYMIC EXPORTS
//to functions or global vars.
extern I64 ObjDemo(...);
//Uncomment these if you wish
//to call them at the command line.
//extern U0 Routine1(U8 *st);
//extern U0 Routine2(U8 *st);
//extern U0 Routine3(U8 *st);
+27
View File
@@ -0,0 +1,27 @@
This demonstrates that linking can be done
at $FG,2$LOAD$FG$ time. This is the TempleOS answer
to $FG,2$OBJ$FG$ files.
Right-Click $FG,2$MakeFile.CPP.Z$FG$ and click $FG,2$INCLUDE$FG$ or
do the following:
1) Do a $LK,"Dir",A="MN:Dir"$() command
2) Right-Click on OD1.PRJ.Z and click $FG,2$AOT COMPILE$FG$.
Right-Click on OD2.PRJ.Z and click $FG,2$AOT COMPILE$FG$.
Right-Click on ODMain.PRJ.Z and click $FG,2$AOT COMPILE$FG$.
3) In any order, do the following and ignore warnings.
Right-Click on OD1.BIN.Z and click $FG,2$LOAD$FG$.
Right-Click on ODMain.BIN.Z and click $FG,2$LOAD$FG$.
Right-Click on OD2.BIN.Z and click $FG,2$LOAD$FG$.
4) Right-Click on ObjDemo.HPP.Z and click $FG,2$INCLUDE$FG$.
5) Type at the command-line:
$ID,2$$FG,2$>ObjDemo("Arg1","Arg2");
$ID,-2$
$FG,2$#include$FG$ the file $LK,"::/Adam/Utils/BinRep.CPP"$ and
call $LK,"BinRep",A="MN:BinRep"$() to analyze the $FG,2$.BIN.Z$FG$ files.
+11
View File
@@ -0,0 +1,11 @@
$WW,1$If you insist on doing $FG,2$AOT$FG$ compiled, old school, programs instead of just-in-time compiled programs, this directory tree has some examples. The main reason to do $FG,2$AOT$FG$ programs is to make closed-source applications. Why not do it like the programs in $FG,2$/Apps$FG$, instead?
See $LK,"Scoping and Linkages",A="FI:::/Doc/ImportExports.TXT"$ for details on $FG,2$extern$FG$, $FG,2$import$FG$, $FG,2$_extern$FG$, $FG,2$_import$FG$, etc.
$FG,5$SingleFileAOT$FG$ shows a single file AOT module.
$FG,5$MultiFileAOT$FG$ shows a multiple file AOT module.
$FG,5$MultiModAOT$FG$ shows a multiple module project. If you $FG,2$#include $FG$the $FG,4$MakeFile$FG$ you'll see a clear example of how syms are exported and imported by modules and bound to syms in task's hash tables.
+8
View File
@@ -0,0 +1,8 @@
1) Do a $LK,"Dir",A="MN:Dir"$() command
2) Right-Click on Single.CPP.Z and click $FG,2$AOT COMPILE$FG$.
3) Do a $LK,"Dir",A="MN:Dir"$() command
4) Right-Click on Single.BIN.Z and click $FG,2$LOAD$FG$.
+22
View File
@@ -0,0 +1,22 @@
// imports all syms from the Adam Task's hash table.
#include "::/Kernel/AOT.HPP"
U0 Main1()
{
"Main1\n";
}
"Single File AOT Demo\n";
Main1;
U0 Main2(I64 n)
{
I64 i;
"Main2\n";
for (i=1;i<=n;i++)
"%d\n",i;
}
Main2(5);
Main1;