Browse Source

LTCD_060719.ISO

v6
Terry A. Davis 16 years ago committed by minexew
commit
f86e69648b
  1. BIN
      0000BOOT/BOOT.BIC
  2. BIN
      0000BOOT/CDBOOT.BIZ
  3. 121
      LT/ACCOUNTS/ADAM3.CPZ
  4. BIN
      LT/ACCOUNTS/FAULT.CPZ
  5. BIN
      LT/ACCOUNTS/FAVOR.MUZ
  6. 84
      LT/ACCOUNTS/INSTALL/USER.CPZ
  7. BIN
      LT/ACCOUNTS/SERVANT.CPZ
  8. BIN
      LT/ACCOUNTS/SYSTEM.CPZ
  9. 114
      LT/ACCOUNTS/TOUR/TOUR.AUZ
  10. 101
      LT/ACCOUNTS/TOUR/TOUR1.AUZ
  11. 76
      LT/ACCOUNTS/TOUR/TOUR2.AUZ
  12. 95
      LT/ACCOUNTS/TOUR/TOUR3.AUZ
  13. 58
      LT/ACCOUNTS/TOUR/TOUR4.AUZ
  14. 10
      LT/ACCOUNTS/TOUR/USER.CPZ
  15. 71
      LT/ACCOUNTS/UPGRADE/USER.CPZ
  16. 47
      LT/ACCOUNTS/USER.CPZ
  17. 27
      LT/ACCOUNTS/USER.MUZ
  18. 67
      LT/ADAM/ADAM2.CPZ
  19. BIN
      LT/ADAM/ADAMASM.ASZ
  20. BIN
      LT/ADAM/ADAMASM.BIZ
  21. 10
      LT/ADAM/ADAMASM.HPZ
  22. BIN
      LT/ADAM/ADAMASM.MPZ
  23. 32
      LT/ADAM/AdamExt.CPZ
  24. 800
      LT/ADAM/COMM.CPZ
  25. 821
      LT/ADAM/DISK10.CPZ
  26. 3346
      LT/ADAM/EDIT.CPZ
  27. 69
      LT/ADAM/EDIT.MUZ
  28. 172
      LT/ADAM/FIFO.CPZ
  29. 834
      LT/ADAM/GRELEM.CPZ
  30. 425
      LT/ADAM/GRMODE2.ASZ
  31. 1228
      LT/ADAM/GRMODE3.CPZ
  32. 14
      LT/ADAM/INPTR.CPZ
  33. 304
      LT/ADAM/IncCompress.CPZ
  34. 136
      LT/ADAM/JOY.CPZ
  35. 58
      LT/ADAM/LOGIN.CPZ
  36. 2240
      LT/ADAM/LTF.CPZ
  37. 72
      LT/ADAM/MATH.CPZ
  38. 189
      LT/ADAM/MOUSE.CPZ
  39. 82
      LT/ADAM/MUSIC.CPZ
  40. 171
      LT/ADAM/ODE.CPZ
  41. BIN
      LT/ADAM/TEST.TXZ
  42. 442
      LT/ADAM/UTILS.CPZ
  43. 1043
      LT/ADAM/WINDOW.CPZ
  44. 769
      LT/ADAM/WORDSTAT.CPZ
  45. 164
      LT/APPS/TIMECLK.CPZ
  46. BIN
      LT/APPS/WARGAME.CPZ
  47. 15
      LT/APPS/WARGAME.MUZ
  48. 1411
      LT/COMPILE/ASM.CPZ
  49. 881
      LT/COMPILE/ASM.TXZ
  50. BIN
      LT/COMPILE/CMP.ASZ
  51. BIN
      LT/COMPILE/CMP.BIZ
  52. BIN
      LT/COMPILE/CMP.HPZ
  53. 1126
      LT/COMPILE/CMP.MPZ
  54. 4083
      LT/COMPILE/CODE.ASZ
  55. 2651
      LT/COMPILE/COMPILE.CPZ
  56. BIN
      LT/COMPILE/DoTest.CPZ
  57. 1687
      LT/COMPILE/LEX.CPZ
  58. BIN
      LT/COMPILE/LoadCmp2.CPZ
  59. 3045
      LT/COMPILE/OPT.CPZ
  60. 773
      LT/COMPILE/PARSE.CPZ
  61. 759
      LT/COMPILE/SPRINTF2.CPZ
  62. 34
      LT/COMPILE/Test.CPZ
  63. BIN
      LT/COMPILE/Test2.CPZ
  64. 15
      LT/DEMO/AutoFile/Demo1.AUZ
  65. 9
      LT/DEMO/AutoFile/Demo2.AUZ
  66. 26
      LT/DEMO/AutoFile/Demo3.AUZ
  67. BIN
      LT/DEMO/AutoFile/Demo3.TXZ
  68. 12
      LT/DEMO/AutoFile/Demo4.CPZ
  69. 23
      LT/DEMO/Caller.CPZ
  70. BIN
      LT/DEMO/CircleTrace.CPZ
  71. 19
      LT/DEMO/CommTerminal.CPZ
  72. 9
      LT/DEMO/DateTime.CPZ
  73. 145
      LT/DEMO/Dawg.CPZ
  74. BIN
      LT/DEMO/Debug/Test.CPZ
  75. 4
      LT/DEMO/DemoDoc.TXZ
  76. BIN
      LT/DEMO/Doodle.CPZ
  77. BIN
      LT/DEMO/Doodle2.CPZ
  78. BIN
      LT/DEMO/Exceptions.CPZ
  79. BIN
      LT/DEMO/FPrintF.CPZ
  80. BIN
      LT/DEMO/GetInput.CPZ
  81. BIN
      LT/DEMO/Graphics/BSpline.CPZ
  82. 29
      LT/DEMO/Graphics/Blot.CPZ
  83. 60
      LT/DEMO/Graphics/Box.CPZ
  84. 12
      LT/DEMO/Graphics/DotNet.CPZ
  85. BIN
      LT/DEMO/Graphics/Sprite1.CPZ
  86. BIN
      LT/DEMO/Graphics/Sprite2.CPZ
  87. BIN
      LT/DEMO/Graphics/Sprite3.CPZ
  88. BIN
      LT/DEMO/Graphics/StarTrek1.CPZ
  89. BIN
      LT/DEMO/Graphics/StarTrek2.CPZ
  90. BIN
      LT/DEMO/Graphics/StarTrek3.CPZ
  91. 15
      LT/DEMO/MsgLoop.CPZ
  92. 20
      LT/DEMO/Music.CPZ
  93. 15
      LT/DEMO/Sound.CPZ
  94. 15
      LT/DEMO/Spy.CPZ
  95. BIN
      LT/DEMO/TreeDemo.CPZ
  96. 22
      LT/DEMO/TreeDemoJoin.CPZ
  97. 183
      LT/DEMO/WinMgr2.CPZ
  98. 39
      LT/DOC/CtrlL.MUZ
  99. 151
      LT/DOC/Dollar.TXZ
  100. 19
      LT/DOC/Graphics.TXZ
  101. Some files were not shown because too many files have changed in this diff Show More

BIN
0000BOOT/BOOT.BIC

Binary file not shown.

BIN
0000BOOT/CDBOOT.BIZ

Binary file not shown.

121
LT/ACCOUNTS/ADAM3.CPZ

@ -0,0 +1,121 @@
/* This file gets included once into the
"Adam" task's memory by $LK,"LoadAdam3","MN:LoadAdam3"$() placed in
$LK,"HOME/USER.CPZ","FI:HOME/USER.CPZ"$. The declarations from this file
are available to all tasks, since all tasks
chain back to Adam.
If you modify this file, you should place it
into your HOME directory. This version is the
default for accounts without a version in HOME.
*/
class RenameSymbolStruct
{
I1 find[256] fmtstr "$$DA -P ,255 \"Find :%s\"$$\r\n";
I1 replace[256] fmtstr "$$DA -P ,255 \"Replace:%s\"$$\r\n";
};
void RenameCurSymbol()
{
I1 *buf;
RenameSymbolStruct r;
BoolU4 old_preempt=Preempt(OFF);
StrCpy(r.find,ws_cur_word);
StrCpy(r.replace,ws_cur_word);
Preempt(old_preempt);
if (PopUpDoForm(&r,"RenameSymbolStruct")) {
buf=MSPrintF("R(\"%s\",\"%s\",\"+r+l+a\");",r.find,r.replace);
PopUp(buf,Fs);
Free(buf);
}
}
void RenameFile()
{
I1 *buf;
RenameSymbolStruct r;
BoolU4 old_preempt=Preempt(OFF);
StrCpy(r.find,ws_cur_word);
StrCpy(r.replace,ws_cur_word);
Preempt(old_preempt);
if (PopUpDoForm(&r,"RenameSymbolStruct")) {
buf=MSPrintF("R(\"%s\",\"%s\",\"+r+l+a\");",r.find,r.replace);
PopUp(buf,Fs);
Free(buf);
}
Move(r.find,r.replace);
}
void FillinTime()
{
LTDate ltdt;
ltdt=GetCurTimeLTDate;
PrintF("$$IV 1$$----%D %T----$$IV 0$$\r",ltdt.date,ltdt.time);
}
BoolU4 My_EditPlugIns(Ltf *l,I8 ch,U8 sc)
{ //You can customize these
U8 sc2,ms=0;
l;ch; //Ref, So not unused Warn
sc2=sc.u1[0];
if (sc2>=SC_F1 && sc2<=SC_F10 &&
(sc & SCF_ALT) &&
!(sc & SCF_CTRL)) {
if (sc2==SC_F1) {
if ((sc & SCF_SHIFT))
PutS("$$FG LTPURPLE$$");
else
PutS("$$FG PURPLE$$");
} else if (sc2==SC_F2) {
if ((sc & SCF_SHIFT))
PutS("$$FG LTRED$$");
else
PutS("$$FG RED$$");
} else if (sc2==SC_F3) {
if ((sc & SCF_SHIFT))
PutS("$$FG LTGREEN$$");
else
PutS("$$FG GREEN$$");
} else if (sc2==SC_F4) {
if ((sc & SCF_SHIFT))
PutS("$$FG LTBLUE$$");
else
PutS("$$FG$$");
} else if (sc2==SC_F6) {
if (!(sc & SCF_SHIFT))
PopUp("WsInit(\"/LT\");");
} else if (sc2==SC_F7) {
if ((sc & SCF_SHIFT))
LtfSafeInsert(Fs->cur_ltf,
"$$HS+C$$$$FG$$$$HE$$");
else
FillinTime();
} else if (sc2==SC_F8) {
if ((sc & SCF_SHIFT))
RenameFile();
else
RenameCurSymbol();
} else if (sc2==SC_F9)
PopUp("PunchIn;");
else if (sc2==SC_F10)
PopUp("PunchOut;");
return TRUE;
}
return FALSE;
}
Cd("/LT/UTILS");;
#include "BOOTINS"
#include "DBG"
#include "DIFF"
#include "GREP"
#include "S2T"
#include "HASHUTIL"
#include "IDE"
#include "BMP"
LoadMapFile("::/LT/OSMain/OS.MPZ"); //Enable Man()
LoadMapFile("::/LT/COMPILE/CMP.MPZ"); //Enable Man()
LoadMapFile("::/LT/ADAM/ADAMASM.MPZ"); //Enable Man()

BIN
LT/ACCOUNTS/FAULT.CPZ

Binary file not shown.

BIN
LT/ACCOUNTS/FAVOR.MUZ

Binary file not shown.

84
LT/ACCOUNTS/INSTALL/USER.CPZ

@ -0,0 +1,84 @@
//This is the startup file for new local users
UseConsoleLtf("USER.MUZ");
Fs->answers_displayed=2; //from 0-8
LoadAdam3;
U8 F(I1 *pattern,I1 *flags="+r+i")
{
return Grep(pattern,"/LT/"TEXT_FILE_MASK,flags);
}
U8 R(I1 *pattern,I1 *replace_text=NULL,I1 *flags="+r+l")
{
return Grep(pattern,"/LT/"TEXT_FILE_MASK,flags,replace_text);
}
U8 FD(I1 *pattern,I1 *flags="+r+i")
{
return Grep(pattern,TEXT_FILE_MASK,flags);
}
U8 RD(I1 *pattern,I1 *replace_text=NULL,I1 *flags="+r+l")
{
return Grep(pattern,TEXT_FILE_MASK,flags,replace_text);
}
PutSysText("ST_USER_STARTUP");
Type("/LT/DOC/Help.TXZ");
Fs->scroll_speed=10;
Bts(&Fs->crt_flags,CRTf_SHOW);
Type("/LT/DOC/StartUp.TXZ");
I1 src,dst,*st1,*st2;
I4 i;
if (Fs->user_num==1) {
for (i=0;i<10;i++) CrLf;
coutln "This will reformat or delete old installations, "
"copy files onto a partition, recompile "
"and modify the boot sector. For this "
"to work, your hard disk partition must "
"already be bootable with a boot loader like LILO. "
"Obviously, the partition "
"you select will lose data and be destroyed. ";
cout "Continue ";
if (YorN) {
cout "\r\nWould you like to view notes on installation, first";
if (YorN)
Edit("/LT/DOC/Install.TXZ");
coutln "\r\n$$BK,1$$$$FG,PURPLE$$Add Drives so you can install.$$FG$$$$BK,0$$";
AddDrives;
src=default_drive;
cout "\r\n\r\n\r\n$$BK,1$$$$FG,PURPLE$$Destination Drive:$$FG$$$$BK,0$$";
dst=GetChar;
coutln;
st1=MSPrintF("%c:/LT",src);
st2=MSPrintF("%c:/LT",dst);
PrintF("Format %c drive ",dst);
if (YorN) {
coutln;
Format(dst,TRUE,FALSE,PT_LT);
} else {
cout "\r\n$$BK 1$$WARNING$$BK 0$$ if you answer yes to the following "
"you will lose all files in your /LT directory.\r\n";
cout "Delete ",st2," Directory ";
if (YorN)
DelTree(st2);
coutln;
}
CopyTree(st1,st2);
st2=MSPrintF("%c:/0000BOOT",dst);
MkDir(st2);
Free(st2);
st2=MSPrintF("%c:/TEMP",dst);
MkDir(st2);
Free(st2);
InstallBoot(dst);
}
}

BIN
LT/ACCOUNTS/SERVANT.CPZ

Binary file not shown.

BIN
LT/ACCOUNTS/SYSTEM.CPZ

Binary file not shown.

114
LT/ACCOUNTS/TOUR/TOUR.AUZ

@ -0,0 +1,114 @@
while (!initial_user_tasks_startup_complete)
SwapInNext;
void ASCIIKeys(I1 *st)
{
U8 ch;
I1 buf[80];
do {
ch=GetKey;
if (ch==*st) {
PutChar(ch);
st++;
} else {
if (*st==CH_CR)
SPrintF(buf,"Press the '$$FG GREEN$$ENTER$$FG$$' key");
else
SPrintF(buf,"Press the '$$FG GREEN$$%c$$FG$$' key",*st);
PopUpOk(buf);
}
} while (*st);
}
void SlowASCIIAutoType(I1 *st)
{
U8 ch;
do {
if (ch=*st++) {
PutChar(ch);
Sleep(100);
}
} while (ch);
}
void SpecialKey(U8 scancode,I1 *name)
{
U8 sc,ch;
I1 buf[80];
do {
ch=GetChar2(&sc);
if (sc&0xFF!=SC_PRTSCRN1) {
if (sc&0xFF!=scancode&0xFF) {
SPrintF(buf,"Press the '$$FG GREEN$$%s$$FG$$' key",name);
PopUpOk(buf);
}
}
} while (sc&0xFF!=scancode&0xFF);
Msg(MSG_KEY_DOWN,ch,sc);
}
void SpecialASCIIKey(U8 ch1,I1 *name,U8 flag_mask=0,U8 flags=0)
{
U8 sc,ch;
I1 buf[80];
do {
ch=GetChar2(&sc);
if (ch && ch!=ch1) {
SPrintF(buf,"Press the '$$FG GREEN$$%s$$FG$$' key",name);
PopUpOk(buf);
}
} while (ch!=ch1 || (sc&flag_mask!=flags));
Msg(MSG_KEY_DOWN,ch,sc);
}
void UntilSpecialKey(U8 scancode)
{
U8 sc,ch;
do {
ch=GetChar2(&sc);
Msg(MSG_KEY_DOWN,ch,sc);
} while (sc&0xFF!=scancode&0xFF);
}
void UntilASCIIKey(U8 ch1)
{
U8 sc,ch;
do {
ch=GetChar2(&sc);
Msg(MSG_KEY_DOWN,ch,sc);
} while (ch!=ch1);
}
public I8 PopUpTourPart()
{
I8 i;
Ltf *l=LtfNew;
LtfPutS(l,"$$FG PURPLE$$LoseThos Tours$$FG$$\r\n\r\n");
LtfPutS(l,"$$CM +LX, 4,4$$$$BT, \"Part 1: The basics\",1$$");
LtfPutS(l,"$$CM +LX, 4,4$$$$BT, \"Part 2: Editing and running programs\",2$$");
LtfPutS(l,"$$CM +LX, 4,4$$$$BT, \"Part 3: Adding macros to your start menu\",3$$");
LtfPutS(l,"$$CM +LX, 4,4$$$$BT, \"Part 4: WordStat\",4$$");
LtfPutS(l,"$$CM +LX, 4,4$$$$BT, \"Done\",-1$$");
i=PopUpMenu(l);
LtfDel(l);
return i;
}
I8 i;
do {
switch (i=PopUpTourPart)
{
case 1:
ExecuteFile("::/LT/ACCOUNTS/TOUR/TOUR1.AUZ");
break;
case 2:
ExecuteFile("::/LT/ACCOUNTS/TOUR/TOUR2.AUZ");
break;
case 3:
ExecuteFile("::/LT/ACCOUNTS/TOUR/TOUR3.AUZ");
break;
case 4:
ExecuteFile("::/LT/ACCOUNTS/TOUR/TOUR4.AUZ");
break;
}
} while (i>=1);

101
LT/ACCOUNTS/TOUR/TOUR1.AUZ

@ -0,0 +1,101 @@
//This puts the cursor at the bottom
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);
PutS("\r");
PopUpOk(
"After clicking 'OKAY', you will be at the\r\n"
"command line.\r\n\r\n"
"Type \"$$FG GREEN$$Dir;$$FG$$\" and press $$FG GREEN$$ENTER$$FG$$.\r\n\r\n"
"You must remember the semicolon.\r\n"
);
ASCIIKeys("Dir;\r");
Sleep(1000); //allow user time to see dir
PutChar(CH_CR);
PopUpOk(
"After clicking 'OKAY', you will be at the\r\n"
"command line.\r\n\r\n"
"Press the $$FG GREEN$$WINDOW$$FG$$s key.\r\n\r\n"
"This will access your macro/menu/help area.\r\n"
"You can customize it. It's like your\r\n"
"START menu.\r\n");
SpecialKey(SC_GUI,"WINDOWS KEY");
Sleep(1000);
PopUpOk(
"For future reference, you can get to the\r\n"
"menu/macro/help area by clicking the left\r\n"
"mouse button when the mouse cursor is on\r\n"
"the word \"MENU\" in the upper-left border\r\n"
"of the window.\r\n");
PopUpOk(
"After clicking 'OKAY', you will be back at\r\n"
"the menu/macro/help area.\r\n\r\n"
"Press $$FG GREEN$$CURSOR-DOWN$$FG$$ five times.\r\n");
//This puts the cursor at the top
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
I8 i;
for (i=0;i<5;i++)
SpecialKey(SC_CURSOR_DOWN,"CURSOR-DOWN");
PopUpOk(
"After clicking 'OKAY', the cursor will be\r\n"
"on top of a macro we wish to run. Usually,\r\n"
"underlined text will do something.\r\n\r\n"
"Macros are normally $$FG LTBLUE$$BLUE$$FG$$ and you run\r\n"
"them by left-clicking the mouse. You can\r\n"
"simulate a left-mouse with a $$FG GREEN$$SPACE$$FG$$\r\n"
"key.\r\n\r\n"
"After clicking OKAY, press $$FG GREEN$$SPACE$$FG$$.\r\n");
ASCIIKeys(" ");
Sleep(1000);
PopUpOk(
"The macro changed directories and did\r\n"
"a $$FG GREEN$$Dir;$$FG$$ command.\r\n\r\n"
"The $$FG RED$$RED$$FG$$ filenames listed are file\r\n"
"links. Left-clicking will edit/view them.\r\n"
"Right-clicking or pressing $$FG GREEN$$ENTER$$FG$$\r\n"
"when the cursor is on top will bring-up a\r\n"
"menu of options.\r\n\r\n"
"The $$FG LTBLUE$$BLUE$$FG$$ underline entries \"$$FG LTBLUE$$.$$FG$$\" and \"$$FG LTBLUE$$..$$FG$$\"\r\n"
"are macros and will change directories.\r\n");
PopUpOk(
"As you can see, the command line is not\r\n"
"different from the help/menu/macro area.\r\n"
"Both use the same commands and have the same\r\n"
"'Widgets' available.\r\n\r\n"
"Both utilize the same underlying document format\r\n"
"known as LoseThos rich text. It is similar to\r\n"
"html because it has ASCII behind it.\r\n\r\n"
"Press \"$$FG GREEN$$CTRL-T$$FG$$\" after clicking 'OKAY' to toggle\r\n"
"to plain text mode.\r\n");
SpecialASCIIKey(20,"CTRL-T");
Sleep(1000);
PopUpOk(
"The widgets are bracketed with dollar sign\r\n"
"characters. \"LK\" stands \"link\" and \"MA\"\r\n"
"stands for \"macro\".\r\n\r\n"
"Now, press \"$$FG GREEN$$CTRL-T$$FG$$\" to toggle back to\r\n"
"regular mode.\r");
SpecialASCIIKey(20,"CTRL-T");
Sleep(1000);
PopUpOk(
"In summary, you left-click on underlined\r\n"
"text or press $$FG GREEN$$SPACE$$FG$$ when the cursor\r\n"
"is on top, to perform the primary action.\r\n"
"You right-click or press $$FG GREEN$$ENTER$$FG$$\r\n"
"to perform a secondary action.\r\n\r\n"
"The $$FG GREEN$$WINDOW$$FG$$'s key will bring-up the help/macro/menus\r\n"
"as will clicking on the word \"MENU\" in the\r\n"
"upper-left corner of a window's border.\r\n\r\n"
"The $$FG GREEN$$CTRL-T$$FG$$ key will toggle plain-text mode.\r\n");

76
LT/ACCOUNTS/TOUR/TOUR2.AUZ

@ -0,0 +1,76 @@
//This puts the cursor at the bottom
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);
PutS("\r");
PopUpOk(
"Now, we're going to demonstrate how to work\r\n"
"with programs. We'll change to the \LT\DEMO\r\n"
"directory. The change directory command\r\n"
"will be typed for you and you just need\r\n"
"to press $$FG GREEN$$ENTER$$FG$$.\r\n\r\n"
"Note, that directories are specified with\r\n"
"a forward slash, not a backslash.\r\n"
"Drives can be specified in a $$FG GREEN$$Cd()$$FG$$ command\r\n"
"and the boot drive is specified with \"$$FG GREEN$$::$$FG$$\".");
PutS("Cd(\"::/LT/DEMO\");Dir;");
ASCIIKeys("\r");
PopUpOk(
"Now, we're going to edit a file. Normally,\r\n"
"you'll probably left-click on a directory\r\n"
"listing to edit a file, but we're going to\r\n"
"type it on the command line.\r\n\r\n"
"Press $$FG GREEN$$ENTER$$FG$$ to complete the command.\r\n");
PutS("Edit(\"Sound.CPZ\");");
ASCIIKeys("\r");
Sleep(1000);
PopUpOk(
"This program gets keys and plays frequencies.\r\n"
"It quits when you press $$FG GREEN$$ESC$$FG$$.\r\n\r\n"
"There is no \"$$FG GREEN$$main()$$FG$$\" function in LoseThos\r\n"
"programs. Any program statements outside\r\n"
"functions get executed when you $$FG GREEN$$#include$$FG$$\r\n"
"them at the command line.\r\n\r\n"
"The \"$$FG GREEN$$Organ;$$FG$$\" statement at the bottom\r\n"
"will run the program when we $$FG GREEN$$#include$$FG$$ it.\r\n");
PopUpOk(
"The editor and most things exit when you press\r\n"
"$$FG GREEN$$ESC$$FG$$. $$FG GREEN$$CTRL-Q$$FG$$ will abort (cancel) most things.\r\n\r\n"
"The $$FG GREEN$$ESC$$FG$$ key can be simulated with a left\r\n"
"double-click, while the $$FG GREEN$$CTRL-Q$$FG$$ key can be\r\n"
"simulated with a right double-click. When\r\n"
"you browse documentation, you'll left-click\r\n"
"on links and right double-click to go back,\r\n"
"unless you want to save changes to documents\r\n"
"using left double-click.\r\n\r\n"
"Press $$FG GREEN$$CTRL-Q$$FG$$ to quit out of the editor.\r\n"
);
SpecialASCIIKey(CH_CTRLQ,"CTRL-Q");
PopUpOk(
"Now, we'll run the Sound.CPZ program.\r\n"
"Press $$FG GREEN$$ENTER$$FG$$ at the command line to\r\n"
"$$FG GREEN$$#include$$FG$$ it. Then press keys to\r\n"
"cause sounds and press $$FG GREEN$$ESC$$FG$$ when\r\n"
"you are done.\r\n");
PutS("#include \"Sound.CPZ\";");
ASCIIKeys("\r");
UntilASCIIKey(CH_ESC);
PopUpOk(
"The program is still in memory and we\r\n"
"can start it again by typing \"$$FG GREEN$$Organ;$$FG$$\".\r\n\r\n"
"Press $$FG GREEN$$ENTER$$FG$$ at the command line to\r\n"
"run it again.\r\n");
PutS("Organ;");
ASCIIKeys("\r");
UntilASCIIKey(27);

95
LT/ACCOUNTS/TOUR/TOUR3.AUZ

@ -0,0 +1,95 @@
//This puts the cursor at the bottom
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);
PutS("\rCd(\"::/LT/DEMO\");Dir;\r");
PopUpOk(
"Now, we're going to add the Sound.CPZ\r\n"
"program to your start menu.\r\n\r\n"
"Press the $$FG GREEN$$WINDOW$$FG$$s key\r\n"
"to get to your menu/macro/help area.\r\n");
SpecialKey(SC_GUI,"WINDOWS KEY");
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
Sleep(1000);
PopUpOk(
"Press $$FG GREEN$$CTRL-L$$FG$$ to invoke the\r\n"
"rich-text resource editor.\r\n");
SpecialASCIIKey(12,"CTRL-L");
PopUpOk(
"Press $$FG GREEN$$CURSOR-DOWN$$FG$$ until you reach\r\n"
"\"Macro\".\r\n");
I8 i;
for (i=0;i<8;i++)
SpecialKey(SC_CURSOR_DOWN,"CURSOR-DOWN");
PopUpOk(
"Press $$FG GREEN$$SPACE$$FG$$.\r\n");
ASCIIKeys(" ");
Sleep(1000);
PopUpOk(
"Now, we'll fill-in the visible text\r\n"
"of the macro.\r\n");
SlowASCIIAutoType("Click Here");
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN);
PopUpOk("Now, we'll fill-in the macro text.\r\n");
SlowASCIIAutoType("Cd(\\\"::/LT/DEMO\\\");;#include \\\"Sound.CPZ\\\";\\r");
PopUpOk("Press $$FG GREEN$$ESC$$FG$$ to exit the form.\r\n");
SpecialASCIIKey(CH_ESC,"ESC");
Sleep(1000);
PopUpOk("Press $$FG GREEN$$CTRL-SHIFT-ENTER$$FG$$ to insert a line feed.\r\n");
SpecialASCIIKey(CH_CR,"CTRL-SHIFT-ENTER",SCF_CTRL|SCF_SHIFT,SCF_CTRL|SCF_SHIFT);
Sleep(1000);
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
PopUpOk(
"Press $$FG GREEN$$SPACE$$FG$$ to test it.\r\n");
ASCIIKeys(" ");
UntilASCIIKey(CH_ESC);
PopUpOk(
"Now, we'll do a fancier macro that pops-up\r\n"
"a new window which dies when finished,\r\n"
"returning memory to the system.\r\n");
Msg(MSG_KEY_DOWN,0,SC_GUI);
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
Msg(MSG_KEY_DOWN,12,0); //CTRL-L
for (i=0;i<8;i++)
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN);
SlowASCIIAutoType(" Click here for Pop-up version");
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN);
SlowASCIIAutoType("Cd(\\\"::/LT/DEMO\\\");;#include \\\"Sound.CPZ\\\"\\r");
PopUpOk(
"Press $$FG GREEN$$CURSOR-DOWN$$FG$$ until you reach\r\n"
"the \"Pop-Up\" check-box.\r\n");
for (i=0;i<2;i++)
SpecialKey(SC_CURSOR_DOWN,"CURSOR-DOWN");
PopUpOk(
"Press $$FG GREEN$$SPACE$$FG$$ to\r\n"
"check the box.\r\n");
ASCIIKeys(" ");
Sleep(500);
PopUpOk("Press $$FG GREEN$$ESC$$FG$$ to exit the form.\r\n");
SpecialASCIIKey(CH_ESC,"ESC");
Sleep(500);
PopUpOk("Press $$FG GREEN$$CTRL-SHIFT-ENTER$$FG$$ to insert a line feed.\r\n");
SpecialASCIIKey(CH_CR,"CTRL-SHIFT-ENTER",SCF_CTRL|SCF_SHIFT,SCF_CTRL|SCF_SHIFT);
Sleep(500);
Msg(MSG_KEY_DOWN,0,SC_CURSOR_UP|SCF_CTRL);
PopUpOk(
"Press $$FG GREEN$$SPACE$$FG$$ to test it.\r\n");
ASCIIKeys(" ");
Sleep(5000);
PopUpOk(
"Press $$FG GREEN$$CTRL-S$$FG$$ to save your\r\n"
"macro/menu/help area file, if you wish.\r\n");

58
LT/ACCOUNTS/TOUR/TOUR4.AUZ

@ -0,0 +1,58 @@
PopUp("WsInit(\"::/LT\");");
if (!ws_task)
ws_task=Spawn(&WsTsk,"WORDSTAT");
//This puts the cursor at the bottom
Msg(MSG_KEY_DOWN,0,SC_CURSOR_DOWN|SCF_CTRL);
PutS("\rCd(\"::/LT/DEMO\");\r");
PopUpOk(
"WordStat is an autocomplete feature\r\n"
"which will also jump to source code.\r\n\r\n"
"We will now place some text on the command\r\n"
"line and jump to source code.\r\n");
PutS("InstallB");
Sleep(1000);
PopUpOk(
"After clicking $$FG GREEN$$OKAY$$FG$$, look at\r\n"
"the $$FG GREEN$$InstallBoot$$FG$$ entry in the WordStat\r\n"
"window. Notice it has a '$$FG GREEN$$*$$FG$$' by it.\r\n"
"This means a source code link is available.\r\n");
sys_cur_focus_task=Fs->parent_tss;
Sleep(2000);
PopUpOk(
"Press $$FG GREEN$$CTRL-SHIFT-F1$$FG$$ to jump to source code.\r\n");
sys_cur_focus_task=Fs->parent_tss;
UntilSpecialKey(SC_F1|SCF_CTRL|SCF_SHIFT);
Sleep(2000);
PopUpOk(
"Press $$FG GREEN$$CTRL-Q$$FG$$ to quit the source code.\r\n");
UntilASCIIKey(CH_CTRLQ);
PopUpOk(
"Press $$FG GREEN$$CTRL-F1$$FG$$ to autocomplete.\r\n");
sys_cur_focus_task=Fs->parent_tss;
UntilSpecialKey(SC_F1|SCF_CTRL);
Sleep(500);
Msg(MSG_KEY_DOWN,CH_CR,SCF_CTRL|SCF_SHIFT);
PutS("\r");
PopUpOk(
"Tip: You can restart the WordStat window if you\r\n"
"have closed it by pressing $$FG GREEN$$CTRL-F1$$FG$$.\r\n");
PopUpOk(
"You can also use the $$FG GREEN$$Man()$$FG$$ function\r\n"
"to jump to source code.\r\n");
SlowASCIIAutoType("Man(\"InstallBoot\");");
Sleep(1000);
PutS("\r");
Sleep(2000);
PopUpOk(
"Press $$FG GREEN$$CTRL-Q$$FG$$ to quit the source code.\r\n");
UntilASCIIKey(CH_CTRLQ);

10
LT/ACCOUNTS/TOUR/USER.CPZ

@ -0,0 +1,10 @@
//This is the startup file for new local users
UseConsoleLtf("USER.MUZ");
Fs->answers_displayed=2; //from 0-8
LoadAdam3;
PutSysText("ST_USER_STARTUP");
Type("/LT/DOC/Help.TXZ");
Bts(&Fs->crt_flags,CRTf_SHOW);
if (Fs->user_num==1)
AutoFile("TOUR");

71
LT/ACCOUNTS/UPGRADE/USER.CPZ

@ -0,0 +1,71 @@
//This is the startup file for new local users
UseConsoleLtf("USER.MUZ");
Fs->answers_displayed=2; //from 0-8
LoadAdam3;
U8 F(I1 *pattern,I1 *flags="+r+i")
{
return Grep(pattern,"/LT/"TEXT_FILE_MASK,flags);
}
U8 R(I1 *pattern,I1 *replace_text=NULL,I1 *flags="+r+l")
{
return Grep(pattern,"/LT/"TEXT_FILE_MASK,flags,replace_text);
}
U8 FD(I1 *pattern,I1 *flags="+r+i")
{
return Grep(pattern,TEXT_FILE_MASK,flags);
}
U8 RD(I1 *pattern,I1 *replace_text=NULL,I1 *flags="+r+l")
{
return Grep(pattern,TEXT_FILE_MASK,flags,replace_text);
}
PutSysText("ST_USER_STARTUP");
Type("/LT/DOC/Help.TXZ");
Fs->scroll_speed=10;
Bts(&Fs->crt_flags,CRTf_SHOW);
Type("/LT/DOC/StartUp.TXZ");
I1 src,dst,*st1,*st2;
I4 i;
if (Fs->user_num==1) {
for (i=0;i<10;i++) CrLf;
coutln "This will copy the /LT directory from "
"the CD-ROM onto a harddisk overwriting old files. "
"It will then recompile "
"and modify the boot sector. If your old "
"installation is the right disk format and "
"you have created your own ACCOUNTS directory "
"that directory will be left intact.";
cout "Continue ";
if (YorN) {
cout "\r\nWould you like to view notes on installation, first";
if (YorN)
Edit("/LT/DOC/Install.TXZ");
coutln "\r\n$$BK,1$$$$FG,PURPLE$$Add Drives so you can upgrade.$$FG$$$$BK,0$$";
AddDrives;
src=default_drive;
cout "\r\n\r\n$$BK,1$$$$FG,PURPLE$$Destination Drive:$$FG$$$$BK,0$$";
dst=GetChar;
coutln;
st1=MSPrintF("%c:/LT",src);
st2=MSPrintF("%c:/LT",dst);
CopyTree(st1,st2);
st2=MSPrintF("%c:/0000BOOT",dst);
MkDir(st2);
Free(st2);
st2=MSPrintF("%c:/TEMP",dst);
MkDir(st2);
Free(st2);
InstallBoot(dst);
}
}

47
LT/ACCOUNTS/USER.CPZ

@ -0,0 +1,47 @@
/*
This is the startup file for new local users.
If you modify this file, you should place it
into your HOME directory. This version is the
default for accounts without a version in HOME.
*/
UseConsoleLtf("USER.MUZ");
Fs->answers_displayed=2; //from 0-8
LoadAdam3;
Fs->EditPlugIns=&My_EditPlugIns;
Ltf *l=Fs->cur_ltf;
l->EditPlugIns=&My_EditPlugIns;
if (l=l->menu_ltf)
l->EditPlugIns=&My_EditPlugIns;
U8 F(I1 *pattern,I1 *flags="+r+i")
{
return Grep(pattern,"/LT/"TEXT_FILE_MASK,flags);
}
U8 R(I1 *pattern,I1 *replace_text=NULL,I1 *flags="+r+l")
{
return Grep(pattern,"/LT/"TEXT_FILE_MASK,flags,replace_text);
}
U8 FD(I1 *pattern,I1 *flags="+r+i")
{
return Grep(pattern,TEXT_FILE_MASK,flags);
}
U8 RD(I1 *pattern,I1 *replace_text=NULL,I1 *flags="+r+l")
{
return Grep(pattern,TEXT_FILE_MASK,flags,replace_text);
}
PutSysText("ST_USER_STARTUP");
Type("/LT/DOC/Help.TXZ");
Fs->scroll_speed=10;
Bts(&Fs->crt_flags,CRTf_SHOW);
Type("/LT/DOC/StartUp.TXZ");

27
LT/ACCOUNTS/USER.MUZ

@ -0,0 +1,27 @@
If you modify this file, you should place it
into your HOME directory. This version is the
default for accounts without a version in HOME.
$MA,"Cd(\"HOME\");Dir;\r"$
$MA,"Cd(\"::/LT/OSMain\");Dir;\r"$
$MA,"Cd(\"::/LT/ADAM\");Dir;\r"$
$MA,"Cd(\"::/LT/APPS\");Dir;\r"$
$MA,"Cd(\"::/LT/DEMO\");Dir;\r"$
$MA,"Cd(\"::/LT/UTILS\");Dir;\r"$
$MA,"Drive('A');\r"$
$MA+A,"Recompile Floppy OS Drive A:","InstallBoot('A');\r"$
$WW,1$$MA+A-X+PU,"Play WarGame","Cd(\"::/LT/APPS\");;#include \"WARGAME\"\r"$
$MA+A-X+PU,"DO-TELL (A fractel-like thing)","Cd(\"::/LT/DEMO\");;#include \"Dawg\"\r"$
$MA+A-X+PU,"StarTrek Game","#include \"::/LT/DEMO/Graphics/StarTrek2\"\r"$
$MA+A,"Tour","Cd(\"::/LT/ACCOUNTS/TOUR\");;AutoFile(\"TOUR\");\r"$
The following can be used if you recompile, adding hard disk support.
$MA,"Drive('D');\r"$
$MA,"Drive('E');\r"$
$MA+A,"Recompile Hard Drive D:","InstallBoot(':','D');\r"$
$MA+A-X+PU,"List functions in alphabetic order","HFunsRep;View;"$
$MA+A-X+PU,"List functions in numeric address order","HMapRep;View;"$

67
LT/ADAM/ADAM2.CPZ

@ -0,0 +1,67 @@
#include "AdamExt"
#include "IncCompress"
#include "MATH"
#include "ODE"
Load("ADAMASM");
#include "ADAMASM.HPZ"
#include "GRMODE3"
#include "MUSIC"
#include "DISK10"
#include "FIFO"
#include "COMM"
#include "INPTR"
#include "GRELEM"
#include "LTF"
#include "UTILS"
#include "MOUSE"
#include "JOY"
#include "WINDOW"
#include "EDIT"
#include "LOGIN"
#include "WORDSTAT"
BoolU4 initial_user_tasks_startup_complete=FALSE;
public void DuelUsers()
{
I1 buf[80];
TssStruct *tss,*tss1;
tss=Spawn(&UserCmdLine);
while (!Bt(&tss->task_flags,TSSf_IDLE))
SwapInNext;
tss->window_top=2;
tss->window_right=(SCREEN_COLS-2)<<1;
tss1=tss;
tss=Spawn(&UserCmdLine);
while (!Bt(&tss->task_flags,TSSf_IDLE))
SwapInNext;
tss->window_top=2;
tss->window_left=SCREEN_COLS<<2>>1;
WindowToTop(tss1);
ws_task=Spawn(&WsTsk,"WORDSTAT");
SPrintF(buf,"Boot Time:%h17Ts\r\n",BootTime);
AdamLog(buf);
initial_user_tasks_startup_complete=TRUE;
}
Preempt(ON);
UseConsoleLtf(NULL);
adam_tss->window_top=2;
adam_tss->window_bottom=10;
update_screen_tss=Spawn(&WindowManagerTsk,"WINDOW MANAGER");
CollectAccntList;
Bts(&Fs->crt_flags,CRTf_SHOW);
if (!(Fs->account=FindSysAccnt(sys_startup_account)))
Fs->account=PopUpGetSysAccnt;
WsInit(wordstat_mask);
//This must be spawned because start-up files
// may invoke the Adam() cmd.
Spawn(&DuelUsers,"SPAWNUSERS");
coutln "\r\nOS Compile Time:",sys_compile_time;

BIN
LT/ADAM/ADAMASM.ASZ

Binary file not shown.

BIN
LT/ADAM/ADAMASM.BIZ

Binary file not shown.

10
LT/ADAM/ADAMASM.HPZ

@ -0,0 +1,10 @@
public LTextern CP_PLOT_SCREEN_I1 BoolU4 PlotScreenChar(U8 w,I8 x,I8 y);
public LTextern CP_PLOT_WINDOW_I1 BoolU4 PlotWindowChar(U8 w,I8 x,I8 y);
public LTextern CP_PLOT_BORDER_I1 BoolU4 PlotBorderChar(U8 w,I8 x,I8 y);
LTextern REVERSE_BITS_TABLE U1 reverse_bits_table[256];
LTextern GR_XOR_LINE void GrXorLine(U4 **dst3,U4 **src,U4 **src2,U8 d5,U4 **vga);
LTextern GR_PLOT_CHAR void GrPlotChar(U1 *font_ptr,U1 attr,U1 **dst2,U8 d1,U8 d2);
LTextern GR_PLOT_BACKGROUND void GrPlotBackground(U1 attr,U1 **dst,U8 d1,U8 d2);
LTextern GR_UPDATE_WINDOWS void GrUpdateWindows();
//The callback is void Plot(aux_data,x,y,z)

BIN
LT/ADAM/ADAMASM.MPZ

Binary file not shown.

32
LT/ADAM/AdamExt.CPZ

@ -0,0 +1,32 @@
extern I8 PopUp(I1 *msg,TssStruct *parent=NULL);
extern U8 LtfPutChar(Ltf *l,I8 ch, U8 sc,BoolU4 old_preempt);
extern void LeftClickLink(Ltf *l,LtfEntry *cl,BoolU4 old_preempt2);
extern void RightClickLink(Ltf *l,LtfEntry *cl,BoolU4 old_preempt2);
extern U8 GetMsg(I8 *param1,I8 *param2,U8 mask=-2,TssStruct *tss=NULL);
extern U8 GetMsgNoWait(I8 *param1,I8 *param2,U8 mask=-2,TssStruct *tss=NULL);
extern void LtfInsert(Ltf *l,LtfEntry *ll);
extern LtfEntry *LtfPutS(Ltf *l,I1 *st);
extern I8 PopUpMenu(Ltf *l,I1 *help=NULL);
extern Ltf *LtfNew();
extern void LtfDel(Ltf *l,BoolU4 root_mem=FALSE);
extern LtfEntry *LtfPrintF(Ltf *l,I1 *src,...);
extern void DrawBorder(BoolU4 solid,I8 l,I8 r,I8 t,I8 b,U1 attr,BoolU4 clip);
extern void EditInsertLtf(Ltf *l,Ltf *b);
extern Ltf *LtfRead(I1 *name,U8 flags=0);
extern BoolU4 View();
extern BoolU4 IsPixelCovered(TssStruct *tss,I8 x,I8 y);
extern void PlotInputPointer();
extern void GrCircle(GrBitMap *base,I8 cx,I8 cy,I8 radius,
I8 step=1,double start_rad=0,double len_rad=pi2);
extern void GrPlot0(GrBitMap *base,I8 x,I8 y);
extern void ClearAllBpts(Ltf *l);
extern void ToggleBpt(Ltf *l,I8 line_offset=0,U8 flags=SBPTF_BPT);
extern void LtfGo();
extern void LtfStep(Ltf *l);
extern void Lpt1PutChar(U1 ch);
extern void WsFillin(I8 n);
extern void WsMan(I8 n,TssStruct *parent=NULL);
extern void WsTsk();
extern TssStruct *ws_task;
extern void Edit(I1 *filename);

800
LT/ADAM/COMM.CPZ

@ -0,0 +1,800 @@
#define CH_XOFF 0x13
#define CH_XON 0x11
#define UART_THR 0
#define UART_RDR 0
#define UART_BRDL 0
#define UART_IER 1
#define UART_BRDH 1
#define UART_IIR 2
#define UART_LCR 3
#define UART_MCR 4
#define UART_LSR 5
#define UART_MSR 6
#define COMMf_INCOMING_XOFFED 0
#define COMMf_OUTGOING_XOFFED 1
#define COMMf_TX_XOFF 2
#define COMMf_TX_XON 3
#define RMT_MAX_PKT_LEN 64 //Must be less then PKT_SYNC
#define RMT_PKT_ACK 0xA5
#define RMT_PKT_NACK 0x5A
#define RMT_PKT_SYNC 0xA3
#define RMT_PKT_SYNC2 0xA7
#define RMT_PKT_CHAR 0xA4
#define RMT_PKT_REQUEST 0xA6
#define RMT_PKT_CLOSE 0xA8
#define RMT_RQST_NONE 0x00
#define RMT_RQST_GETMSG 0x01
#define RMT_RQST_TX_FILE 0x02
#define RMT_RQST_RX_FILE 0x03
#define RMT_RQST_TX_BUF 0x04
#define RMT_RQST_RX_BUF 0x05
#define RMT_RQST_EXE_LOCAL 0x06
#define RMT_RQST_PUTS_CNT 0x07
#define RMT_RQST_MAX 0x07
U8 comm_base[5]={0,0x3F8,0x2F8,0x3E8,0x2E8};
U1Fifo *comm_Rx_fifos[5]={NULL,NULL,NULL,NULL,NULL};
U1Fifo *comm_Tx_fifos[5]={NULL,NULL,NULL,NULL,NULL};
U8 comm_flags[5]={0,0,0,0,0};
LTChnl *comm_chnls[5]={NULL,NULL,NULL,NULL,NULL};
public void RxClose(LTChnl *chnl)
{
U8 base;
U8 old_flags=GetFlags;
if (!chnl || !chnl->type) return;
if (chnl->type==LCT_COMM) {
base=comm_base[chnl->port];
OutP(base+UART_IER,0);
Cli;
if (comm_Rx_fifos[chnl->port]) {
DelU1Fifo(comm_Rx_fifos[chnl->port]);
comm_Rx_fifos[chnl->port]=NULL;
}
if (comm_Tx_fifos[chnl->port]) {
DelU1Fifo(comm_Tx_fifos[chnl->port]);
comm_Tx_fifos[chnl->port]=NULL;
}
comm_chnls[chnl->port]=NULL;
SetFlags(old_flags);
}
AFree(chnl);
}
public void CommPutChar(U8 port,U1 b)
{
U8 old_flags=GetFlags;
U8 base=comm_base[port];
Cli;
if (b==CH_XOFF)
Bts(&comm_flags[port],COMMf_TX_XOFF);
else if (b==CH_XON)
Bts(&comm_flags[port],COMMf_TX_XON);
else {
if (U1FifoCnt(comm_Tx_fifos[port])>comm_Tx_fifos[port]->mask-4) {
SetFlags(old_flags);
while (U1FifoCnt(comm_Tx_fifos[port])>comm_Tx_fifos[port]->mask-4)
SwapInNext;
Cli;
}
if (Bt(&comm_flags[port],COMMf_OUTGOING_XOFFED)) {
SetFlags(old_flags);
while (Bt(&comm_flags[port],COMMf_OUTGOING_XOFFED))
SwapInNext;
Cli;
}
if (comm_Tx_fifos[port])
U1FifoInsert(comm_Tx_fifos[port],b);
}
OutP(base+UART_IER,3); //Enable TX & RX IRQ
SetFlags(old_flags);
BusyWait(300);
}
public void RmtFlushRxFifo(LTChnl *chnl)
{
if (!chnl || !chnl->type) return;
U1FifoFlush(comm_Rx_fifos[chnl->port]);
if (Bt(&comm_flags[chnl->port],COMMf_INCOMING_XOFFED))
chnl->PutChar(chnl,CH_XON);
}
public void RmtFlushTxFifo(LTChnl *chnl)
{
U8 base=comm_base[chnl->port];
if (!chnl || !chnl->type) return;
U1FifoFlush(comm_Tx_fifos[chnl->port]);
while (!(InP(base+UART_LSR) & 0x20))
SwapInNext;
}
public void RmtPrintF(LTChnl *chnl,I1 *src,...)
{
I1 *buf,*ptr;
if (!chnl || !chnl->type) return;
buf=SPrintFJoin(NULL,src,argc,argv);
ptr=buf;
while (*ptr)
chnl->PutChar(chnl,*ptr++);
Free(buf);
}
public void CommPrintF(U8 port,I1 *src,...)
{
RmtPrintF(comm_chnls[port],src,argc,argv);
}
void CommRxTxChar(U8 port)
{
U8 ch=0,irq,base=comm_base[port];
BoolU4 have_one;
if (comm_Rx_fifos[port] &&
comm_Tx_fifos[port]) {
while (TRUE) {
irq=InP(base+UART_IIR);
if ((irq & 0x07)==4) { //RX IRQ
ch=InP(base+UART_RDR);
if (ch==CH_XOFF)
Bts(&comm_flags[port],COMMf_OUTGOING_XOFFED);
else if (ch==CH_XON)
Btr(&comm_flags[port],COMMf_OUTGOING_XOFFED);
else {
U1FifoInsert(comm_Rx_fifos[port],ch);
if (U1FifoCnt(comm_Rx_fifos[port])>comm_Rx_fifos[port]->mask>>1)
CommPutChar(port,CH_XOFF);
}
} else if ((irq & 0x07)==2) { //TX IRQ
have_one=TRUE;
if (Btr(&comm_flags[port],COMMf_TX_XOFF))
ch=CH_XOFF;
else if (Btr(&comm_flags[port],COMMf_TX_XON))
ch=CH_XON;
else if (!U1FifoRemove(comm_Tx_fifos[port],&ch))
have_one=FALSE;
if (have_one) {
if (ch==CH_XOFF)
Bts(&comm_flags[port],COMMf_INCOMING_XOFFED);
else if (ch==CH_XON)
Btr(&comm_flags[port],COMMf_INCOMING_XOFFED);
OutP(base+UART_THR,ch);
}
if (!U1FifoCnt(comm_Tx_fifos[port]))
OutP(base+UART_IER,1); //Enable RX IRQ
} else
break;
}
}
}
public I8 RmtRxFifoCnt(LTChnl *chnl)
{
if (!chnl || !chnl->type) return 0;
return U1FifoCnt(comm_Rx_fifos[chnl->port]);
}
public I8 RmtTxFifoCnt(LTChnl *chnl)
{
if (!chnl || !chnl->type) return 0;
return U1FifoCnt(comm_Tx_fifos[chnl->port]);
}
public void RmtWaitTxDone(LTChnl *chnl)
{
U8 base=comm_base[chnl->port];
if (!chnl || !chnl->type) return;
while (RmtTxFifoCnt(chnl))
SwapInNext;
while (!(InP(base+UART_LSR) & 0x20))
SwapInNext;
}
void Irq03Handler()
{
CommRxTxChar(2);
CommRxTxChar(4);
}
void Irq04Handler()
{
CommRxTxChar(1);
CommRxTxChar(3);
}
public U1 CommGetChar(U8 port)
{
U8 ch=0;
while (!U1FifoRemove(comm_Rx_fifos[port],&ch))
SwapInNext;
if (Bt(&comm_flags[port],COMMf_INCOMING_XOFFED) &&
U1FifoCnt(comm_Rx_fifos[port])<comm_Rx_fifos[port]->mask>>2)
CommPutChar(port,CH_XON);
return ch;
}
public U1 RmtGetChar(LTChnl *chnl)
{
if (!chnl || !chnl->type)
return 0;
return CommGetChar(chnl->port);
}
public BoolU4 CommScanChar(U8 port,U1 *ch)
{
U8 ch1=0;
if (U1FifoPeek(comm_Rx_fifos[port],&ch1)) {
U1FifoRemove(comm_Rx_fifos[port],&ch1);
*ch=ch1;
if (Bt(&comm_flags[port],COMMf_INCOMING_XOFFED) &&
U1FifoCnt(comm_Rx_fifos[port])<comm_Rx_fifos[port]->mask>>2)
CommPutChar(port,CH_XON);
return TRUE;
} else
return FALSE;
}
public BoolU4 RmtScanChar(LTChnl *chnl,U1 *ch)
{
if (!chnl || !chnl->type)
return 0;
return CommScanChar(chnl->port,ch);
}
void CommRmtPutChar(LTChnl *chnl,U1 b)
{
CommPutChar(chnl->port,b);
}
U1 CommRmtGetChar(LTChnl *chnl)
{
return CommGetChar(chnl->port);
}
BoolU4 CommRmtScanChar(LTChnl *chnl,U1 *ch)
{
return CommScanChar(chnl->port,ch);
}
public LTChnl *CommOpen8N1(U8 port=1,U8 baud=38400)
{
LTChnl *chnl=NULL;
U8 old_flags=GetFlags,base=comm_base[port];
Cli;
if (!port || port>4 || comm_chnls[port])
goto co_exit;
chnl=AMAllocZ(sizeof(LTChnl));
comm_chnls[port]=chnl;
chnl->type=LCT_COMM;
base=comm_base[port];
chnl->port=port;
chnl->baud=baud;
chnl->PutChar=&CommRmtPutChar;
chnl->GetChar=&CommRmtGetChar;
chnl->ScanChar=&CommRmtScanChar;
if (comm_Rx_fifos[chnl->port])
DelU1Fifo(comm_Rx_fifos[chnl->port]);
if (comm_Tx_fifos[chnl->port])
DelU1Fifo(comm_Tx_fifos[chnl->port]);
comm_flags[chnl->port]=0;
comm_Rx_fifos[chnl->port]=NewU1Fifo(0x2000); //must be power of 2
comm_Tx_fifos[chnl->port]=NewU1Fifo(0x2000); //must be power of 2
OutP(base+UART_LCR,0); //Set for IER
OutP(base+UART_IER,0);
OutP(base+UART_LCR,0x80); //Enable baud rate control
OutP(base+UART_BRDL,(0x180/(baud/300)) & 0xFF); //LSB
OutP(base+UART_BRDH,(0x180/(baud/300)) / 256); //MSB
OutP(base+UART_LCR,3); // 8-none-1
InP(base+UART_RDR); //read garbage
InP(base+UART_LSR);
OutP(base+UART_MCR,4);
OutP(base+UART_IER,0); //DIsable all IRQ
OutP(base+UART_MCR,0xA); //out2 and rts
OutP(base+UART_IER,1); //Enable RX IRQ
co_exit:
SetFlags(old_flags);
return chnl;
}
public void CommClose(U8 port)
{
LTChnl *chnl=comm_chnls[port];
RxClose(chnl);
}
ext[EXT_IRQ03]=&Irq03Handler;
ext[EXT_IRQ04]=&Irq04Handler;
U8 RmtTxPktU1(LTChnl *chnl,U1 b)
{
if (!chnl || !chnl->type) return 0;
if (b==CH_XOFF || b==CH_XON ||
b==CH_ESC || b==RMT_PKT_CHAR ||
b==RMT_PKT_REQUEST ||
b==RMT_PKT_CLOSE) {
chnl->PutChar(chnl,CH_ESC);
chnl->PutChar(chnl,b^0x80);
return 2;
} else {
chnl->PutChar(chnl,b);
return 1;
}
}
BoolU4 RmtRxPktU1(LTChnl *chnl,U1 *b,
U8 timeout_jiffies,BoolU4 *esc=NULL)
{
U1 b1;
U8 timeout;
*b=RMT_PKT_NACK;
if (esc)
*esc=FALSE;
if (!chnl || !chnl->type)
return FALSE;
timeout=jiffies+timeout_jiffies;
while (jiffies<timeout) {
if (chnl->ScanChar(chnl,&b1)) {
if (b1==CH_ESC) {
timeout=jiffies+timeout_jiffies;
while (jiffies<timeout) {
if (chnl->ScanChar(chnl,&b1)) {
*b=b1^0x80;
if (esc) *esc=TRUE;
return TRUE;
}
SwapInNext;
}
return FALSE;
} else {
if (b1==RMT_PKT_CLOSE) {
Fs->rmt_chnl=NULL;
throw;
}
*b=b1;
return TRUE;
}
}
SwapInNext;
}
return FALSE;
}
void RmtTxPkt(LTChnl *chnl,U1 *p,U8 size,U8 rqst=RMT_RQST_NONE)
{
U1 b,xsum;
U8 i;
if (!chnl || !chnl->type) return;
if (rqst) {
rt_err1:
RmtFlushTxFifo(chnl);
chnl->PutChar(chnl,RMT_PKT_REQUEST);
RmtWaitTxDone(chnl);
RmtFlushRxFifo(chnl);
RmtTxPktU1(chnl,rqst);
RmtWaitTxDone(chnl);
RmtRxPktU1(chnl,&b,JIFFY_FREQ/50);
if (b!=RMT_PKT_ACK)
goto rt_err1;
} else if (size==1) {
rt_err2:
RmtFlushTxFifo(chnl);
chnl->PutChar(chnl,RMT_PKT_CHAR);
RmtWaitTxDone(chnl);
RmtFlushRxFifo(chnl);
RmtTxPktU1(chnl,p[0]);
RmtWaitTxDone(chnl);
RmtRxPktU1(chnl,&b,JIFFY_FREQ/50);
if (b!=RMT_PKT_ACK)
goto rt_err2;
} else {
rt_err3:
RmtFlushTxFifo(chnl);
RmtTxPktU1(chnl,RMT_PKT_SYNC);
RmtWaitTxDone(chnl);
RmtFlushRxFifo(chnl);
RmtTxPktU1(chnl,RMT_PKT_SYNC2);
RmtWaitTxDone(chnl);
RmtRxPktU1(chnl,&b,JIFFY_FREQ/50);
if (b!=RMT_PKT_ACK)
goto rt_err3;
RmtTxPktU1(chnl,size);
RmtWaitTxDone(chnl);
RmtRxPktU1(chnl,&b,JIFFY_FREQ/50);
if (b!=RMT_PKT_ACK)
goto rt_err3;
xsum=0x3A;
for (i=0;i<size;i++) {
b=p[i];
RmtTxPktU1(chnl,b);
xsum^=b;
}
while (RmtTxFifoCnt(chnl)) {
if (RmtRxFifoCnt(chnl)) {
if (RmtScanChar(chnl,&b)) {
if (b==RMT_PKT_NACK) {
RmtFlushRxFifo(chnl);
goto rt_err3;
}
}
}
SwapInNext;
}
RmtTxPktU1(chnl,xsum);
RmtWaitTxDone(chnl);
RmtRxPktU1(chnl,&b,JIFFY_FREQ/50);
if (b!=RMT_PKT_ACK)
goto rt_err3;
}
}
void RmtRxPkt(LTChnl *chnl,U1 *p,U8 *size=NULL,U8 *rqst=NULL)
{
U1 b,b1,xsum;
U8 i,s,r;
BoolU4 esc;
if (!chnl || !chnl->type) {
if (size) *size=0;
if (rqst) *rqst=0;
return;
}
rr_start:
RmtFlushTxFifo(chnl);
if (RmtRxFifoCnt(chnl)>2)
RmtFlushRxFifo(chnl);
s=0;
r=0;
RmtRxPktU1(chnl,&b,JIFFY_FREQ);
RmtRxPktU1(chnl,&b1,JIFFY_FREQ/50,&esc);
rr_cont:
if (b==RMT_PKT_REQUEST) {
if (b1>RMT_RQST_MAX) {
if (b1==RMT_PKT_REQUEST && !esc)
goto rr_cont;
else
goto rr_err;
}
r=b1;
s=0;
goto rr_exit;
} else if (b==RMT_PKT_CHAR) {
if (b1==RMT_PKT_CHAR && !esc)
goto rr_cont;
*p=b1;
s=1;
goto rr_exit;
} else if (b==RMT_PKT_SYNC) {
if (b1!=RMT_PKT_SYNC2) {
if (b1==RMT_PKT_SYNC)
goto rr_cont;
else
goto rr_err;
}
RmtTxPktU1(chnl,RMT_PKT_ACK);
RmtWaitTxDone(chnl);
RmtRxPktU1(chnl,&s,JIFFY_FREQ/50);
if (s>RMT_MAX_PKT_LEN)
goto rr_err;
RmtTxPktU1(chnl,RMT_PKT_ACK);
RmtWaitTxDone(chnl);
xsum=0x3A;
for (i=0;i<s;i++) {
if (!RmtRxPktU1(chnl,&p[i],JIFFY_FREQ/50))
goto rr_err;
xsum^=p[i];
}
RmtRxPktU1(chnl,&b,JIFFY_FREQ/50);
if (b!=xsum)
goto rr_err;
goto rr_exit;
}
rr_err:
RmtTxPktU1(chnl,RMT_PKT_NACK);
RmtWaitTxDone(chnl);
goto rr_start;
rr_exit:
RmtTxPktU1(chnl,RMT_PKT_ACK);
RmtWaitTxDone(chnl);
if (size) *size=s;
if (rqst) *rqst=r;
}
public void RmtTxBlk(LTChnl *chnl,U1 *buf,I8 cnt)
{
U1 b[RMT_MAX_PKT_LEN];
U8 size;
if (!chnl || !chnl->type) return;
while (cnt>0) {
if (cnt<RMT_MAX_PKT_LEN)
size=cnt;
else
size=RMT_MAX_PKT_LEN;
MemCpy(b,buf,size);
RmtTxPkt(chnl,b,size);
cnt-=size;
buf+=size;
progress1=cnt;
}
}
public U1 *RmtRxBlk(LTChnl *chnl,I8 cnt)
{
U1 *result,*buf;
U1 b[RMT_MAX_PKT_LEN];
U8 size=0;
if (!chnl || !chnl->type) return NULL;
result=MAlloc(cnt);
buf=result;
while (cnt>0) {
RmtRxPkt(chnl,b,&size);
MemCpy(buf,b,size);
cnt-=size;
buf+=size;
progress1=cnt;
}
return result;
}
public U8 RmtGetMsg(LTChnl *chnl,I8 *p1,I8 *p2)
{
U8 cmd,d,size;
U1 b[RMT_MAX_PKT_LEN];
*p1=0;
*p2=0;
if (!chnl || !chnl->type)
return 0;
if (jiffies<chnl->null_msg_jiffy)
return 0;
else {
RmtTxPkt(chnl,NULL,0,RMT_RQST_GETMSG);
RmtRxPkt(chnl,b,&size);
if (size!=sizeof(U8)*3)
return 0;
cmd=b[0]><(U8);
*p1=b[8]><(U8);
*p2=b[16]><(U8);
if (!cmd)
chnl->null_msg_jiffy=jiffies+JIFFY_FREQ/50;
}
return cmd;
}
public void RmtSendMsg(LTChnl *chnl,U8 cmd,I8 p1,I8 p2)
{
U1 b[RMT_MAX_PKT_LEN];
if (!chnl || !chnl->type) return;
if (cmd) {
b[0]><(U8)=cmd;
b[8]><(U8)=p1;
b[16]><(U8)=p2;
RmtTxPkt(chnl,b,sizeof(U8)*3);
} else
RmtTxPkt(chnl,b,1);
}
public void RmtPutCharSC(LTChnl *chnl,I8 ch,U8 sc)
{
if (!chnl || !chnl->type) return;
if (ch)
RmtTxPkt(chnl,&ch,1);
}
public void RmtTxBuf(LTChnl *chnl,U1 *buf,U8 size)
{
if (!chnl || !chnl->type) return;
if (buf) {
RmtTxBlk(chnl,&size,sizeof(U8));
RmtTxBlk(chnl,buf,size);
}
}
public U1 *RmtRxBuf(LTChnl *chnl,U8 *size=NULL)
{
U1 *buf;
U8 *size2;
if (size) *size=0;
if (!chnl || !chnl->type) return NULL;
size2=RmtRxBlk(chnl,sizeof(U8));
buf=RmtRxBlk(chnl,*size2);
if (size) *size=*size2;
Free(size2);
return buf;
}
public void RmtTxFile(LTChnl *chnl,I1 *filename,
BoolU4 raw=TRUE)
{
U8 size;
U1 *buf;
if (!chnl || !chnl->type) return;
buf=ReadFile(filename,&size,NULL,raw);
if (buf) {
RmtTxBuf(chnl,buf,size);
Free(buf);
}
}
public U8 RmtRxFile(LTChnl *chnl,I1 *filename,
BoolU4 raw=TRUE)
{
U8 size;
U1 *buf;
if (!chnl || !chnl->type) return 0;
if (buf=RmtRxBuf(chnl,&size)) {
WriteFile(filename,buf,size,0,0,raw);
Free(buf);
}
return size;
}
public void RmtTxPutS(LTChnl *chnl,I1 *st)
{
U8 len;
if (!chnl || !chnl->type) return;
if (st) {
len=StrLen(st);
if (len) {
if (len>RMT_MAX_PKT_LEN) {
RmtTxPkt(chnl,NULL,0,RMT_RQST_PUTS_CNT);
RmtTxBuf(chnl,st,len+1);
} else
RmtTxBlk(chnl,st,len);
}
}
}
public void RmtTxPutChar(LTChnl *chnl,I8 ch)
{
if (!chnl || !chnl->type) return;
if (ch)
RmtTxPkt(chnl,&ch,1);
}
public I1 *RmtRxPutS(LTChnl *chnl,U8 *rqst=NULL)
{
U1 b[RMT_MAX_PKT_LEN];
U8 size;
U1 *buf=NULL;
if (!chnl || !chnl->type) return NULL;
if (RmtRxFifoCnt(chnl)>=2) {
RmtRxPkt(chnl,b,&size,rqst);
if (size) {
buf=MAlloc(size+1);
MemCpy(buf,b,size);
buf[size]=0;
} else
buf=MAllocZ(1);
}
return buf;
}
/***************
public U1 *RmtRqstTxBuf(U8 *size=NULL)
{
LTChnl *chnl=Fs->rmt_chnl;
if (!chnl || !chnl->type) return NULL;