TempleOSTS_130315.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:45:37 +02:00
1 parent e57428affb
commit 17b71f1a2d
958 files changed
+26043 -15907

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
import U0 PrintF(U8 *fmt,...);
U0 Routine1(U8 *st)
{
PrintF("Routine1:%s\n",st);
}
+8
View File
@@ -0,0 +1,8 @@
import U0 PrintF(U8 *fmt,...);
U0 Routine2(U8 *st)
{
PrintF("Routine2:%s\n",st);
}
+28
View File
@@ -0,0 +1,28 @@
import U0 PrintF(U8 *fmt,...);
U0 Routine3(U8 *st)
{
PrintF("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++)
PrintF("Arg %d:%08X\n",i,argv[i]);
Routine1(argv[0]);
if (argc>1) {
Routine2(argv[1]);
if (argc>2)
Routine3(argv[2]);
}
} else
PrintF("Pass string parameters for args 1 and 2.\n");
return argc;
}
@@ -0,0 +1 @@
extern I64 ModuleDemo(...);
@@ -0,0 +1,13 @@
// imports all syms from the Adam Task's hash table.
#include "::/TempleOS/Kernel/AOTAdam.HPP"
//If you just want some of the symbols:
//#include "::/TempleOS/Kernel/AOT.HPP"
#exe {Cd("::/TempleOS/Demo/OldSchool/Demo1");};
#include "MD1"
#include "MD2"
#include "MDMain"
+11
View File
@@ -0,0 +1,11 @@
1) Do a $LK,"Dir","MN:Dir"$() command
2) Right-Click on ModuleDemo.PRJ.Z and click $FG,2$COMPILE$FG$.
3) Right-Click on ModuleDemo.BIN.Z and click $FG,2$LOAD$FG$.
4) Right-Click on ModuleDemo.HPP.Z and click $FG,2$INCLUDE$FG$.
5) Type at the command-line:
$ID,2$$FG,2$>ModuleDemo("Param1","Param2");
$ID,-2$
@@ -0,0 +1,24 @@
Cd("::/TempleOS/Demo/OldSchool/Demo2");;
Cmp("OD1");
Cmp("OD2");
Cmp("ODMain");
Load("OD1");
Load("OD2");
Load("ODMain");
#include "ObjDemo.HPP"
ObjDemo("Success");
#ifndef BinRep
#include "::/TempleOS/Adam/BinRep"
#endif
PressAKey;
BinRep("OD2");
PressAKey;
BinRep("ODMain");
PressAKey;
HashRep(Fs->hash_table,HTG_ALL,NULL,"-p-r");
Binary file not shown.
+12
View File
@@ -0,0 +1,12 @@
// imports all syms from the Adam Task's hash table.
#include "::/TempleOS/Kernel/AOTAdam.HPP"
import U0 Routine3(U8 *st);
U0 Routine1(U8 *st)
{
PrintF("Routine1:%s\n",st);
Routine3("What the!!!");
}
Binary file not shown.
+31
View File
@@ -0,0 +1,31 @@
// imports all syms from the Adam Task's hash table.
#include "::/TempleOS/Kernel/AOTAdam.HPP"
asm {
USE64
IMPORT Beep;
_MY_BEEP::
ENTER 0
PUSH FALSE
PUSH 300
CALL Beep
LEAVE
RET
}
_extern _MY_BEEP U0 MyBeep();
U0 Routine2(U8 *st)
{
PrintF("Routine2:%s\n",st);
MyBeep();
}
PutS("$$BK,1$$Woo-Hoo!$$BK,0$$\n");
Dir;
PutS("$$BK,1$$Woo-Hoo!$$BK,0$$\n");
Routine2("Cool");
Binary file not shown.
+37
View File
@@ -0,0 +1,37 @@
// imports all syms from the Adam Task's hash table.
#include "::/TempleOS/Kernel/AOTAdam.HPP"
//If you just want some of the symbols:
//#include "::/TempleOS/Kernel/AOT.HPP"
import U0 Routine1(U8 *st);
import U0 Routine2(U8 *st);
_import _MY_BEEP U0 MyBeep();
U0 Routine3(U8 *st)
{
PrintF("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++)
PrintF("Arg %d:%08X\n",i,argv[i]);
Routine1(argv[0]);
if (argc>1) {
Routine2(argv[1]);
if (argc>2)
Routine3(argv[2]);
}
} else
PutS("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","MN:Dir"$() command
2) Right-Click on OD1.PRJ.Z and click $FG,2$COMPILE$FG$.
Right-Click on OD2.PRJ.Z and click $FG,2$COMPILE$FG$.
Right-Click on ODMain.PRJ.Z and click $FG,2$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("Param1","Param2");
$ID,-2$
$FG,2$#include$FG$ the file $LK-A,"::/TempleOS/Adam/BinRep.CPP"$ and
call $LK,"BinRep","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$/TempleOS/Apps$FG$ instead?
See $LK,"Scoping and Linkages","FI:::/TempleOS/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$Demo1$FG$ shows a multiple file AOT module.
$FG,4$
$FG,5$Demo2$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.
$FG,4$