LTCD_070816.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:45:20 +02:00
1 parent d14bbc24f9
commit 0e9364ff4c
506 files changed
+157705 -41812

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
//Practice your ASCII knowledge ;-)
void ASCIIOrgan()
{
U1 ch;
coutln "Press keys to make sounds";
coutln "and press ESC to exit.";
do {
//We don't want echo or scan codes, so we use NULL and FALSE...
ch=GetChar(NULL,FALSE);
Sound((ch-28)*25);
} while (ch!=CH_ESC && ch!=CH_CTRLQ);
Sound(0);
}
ASCIIOrgan;
+15
View File
@@ -0,0 +1,15 @@
/* To run this, do a directory, right click on
this file's name and select "AutoFile".
Or, type $LK,"AutoFile","MN:AutoFile"$(filename);
See $LK,"AutoFile","FF:::/LT/Doc/OSGlossary.GLZ,AutoFile"$ in the glossary for more info.
*/
//This is to demo autofiles.
I8 i;
for (i=0;i<3;i++)
PutS("Dir;\r");
PutS("$$FG,RED$$//Press a letter to complete the mask$$FG$$\r");
PutS("Dir(\"*.");
I1 ch=GetChar(NULL,FALSE); //Prompt for first digit of mask
PrintF("%c*\");\r",ch);
+9
View File
@@ -0,0 +1,9 @@
/* To run this, do a directory, right click on
this file's name and select "AutoFile".
Or, type $LK,"AutoFile","MN:AutoFile"$(filename);
See $LK,"AutoFile","FF:::/LT/Doc/OSGlossary.GLZ,AutoFile"$ in the glossary for more info.
*/
PutS("$$FG,RED$$ProfAll;$$FG$$\r");
PutS("$$FG,RED$$//Collecting Data$$FG$$");
PressAKey;
PutS("\r$$FG,RED$$ProfRep;$$FG$$\r");
Binary file not shown.
+260
View File
@@ -0,0 +1,260 @@
#define EC_NULL 0xD7
#define EC_NOP 0xD8
#define EC_U8 0xD9
#define EC_U4 0xDA
#define EC_U2 0x04
#define EC_U1 0x05
#define EC_DOUBLE 0x06
#define EC_STR_CONST 0x07
#define EC_RBP 0x08
#define EC_FS 0x09
#define EC_COM 0x0A
#define EC_NOT 0x0B
#define EC_UNARY_MINUS 0x0C
#define EC_ADDRESS 0x0D
#define EC_U8_DISP32 0x0E
#define EC_U4_DISP32 0x0F
#define EC_U2_DISP32 0x10
#define EC_U1_DISP32 0x11
#define EC_U8_DISP8 0x12
#define EC_U4_DISP8 0x13
#define EC_U2_DISP8 0x14
#define EC_U1_DISP8 0x15
#define EC_DEREF_U8 0x16
#define EC_DEREF_U4 0x17
#define EC_DEREF_U2 0x18
#define EC_DEREF_U1 0x19
#define EC_U8_PP 0x1A
#define EC_U4_PP 0x1B
#define EC_U2_PP 0x1C
#define EC_U1_PP 0x1D
#define EC_U8_MM 0x1E
#define EC_U4_MM 0x1F
#define EC_U2_MM 0x20
#define EC_U1_MM 0x21
#define EC_PP_U8 0x22
#define EC_PP_U4 0x23
#define EC_PP_U2 0x24
#define EC_PP_U1 0x25
#define EC_MM_U8 0x26
#define EC_MM_U4 0x27
#define EC_MM_U2 0x28
#define EC_MM_U1 0x29
#define EC_SHL 0x2A
#define EC_SHR 0x2B
#define EC_MULTIPLICATION 0x2C
#define EC_DIVISION 0x2D
#define EC_REMAINDER 0x2E
#define EC_AND 0x2F
#define EC_OR 0x30
#define EC_XOR 0x31
#define EC_ADDITION 0x32
#define EC_SUBTRACTION 0x33
#define EC_EQUAL_EQUAL 0x34
#define EC_NOT_EQUAL_TO 0x35
#define EC_LESS_THAN 0x36
#define EC_GREATER_THAN 0x37
#define EC_LESS_OR_EQUAL 0x38
#define EC_GREATER_OR_EQUAL 0x39
#define EC_AND_AND 0x3A
#define EC_OR_OR 0x3B
#define EC_XOR_XOR 0x3C
#define EC_COLON 0x3D
#define EC_QUESTION 0x3E
#define EC_ASSIGN_U8 0x3F
#define EC_ASSIGN_U4 0x40
#define EC_ASSIGN_U2 0x41
#define EC_ASSIGN_U1 0x42
#define EC_SHL_EQUAL_U8 0x43
#define EC_SHL_EQUAL_U4 0x44
#define EC_SHL_EQUAL_U2 0x45
#define EC_SHL_EQUAL_U1 0x46
#define EC_SHR_EQUAL_U8 0x47
#define EC_SHR_EQUAL_U4 0x48
#define EC_SHR_EQUAL_U2 0x49
#define EC_SHR_EQUAL_U1 0x4A
#define EC_MUL_EQUAL_U8 0x4B
#define EC_MUL_EQUAL_U4 0x4C
#define EC_MUL_EQUAL_U2 0x4D
#define EC_MUL_EQUAL_U1 0x4E
#define EC_DIV_EQUAL_U8 0x4F
#define EC_DIV_EQUAL_U4 0x50
#define EC_DIV_EQUAL_U2 0x51
#define EC_DIV_EQUAL_U1 0x52
#define EC_AND_EQUAL_U8 0x53
#define EC_AND_EQUAL_U4 0x54
#define EC_AND_EQUAL_U2 0x55
#define EC_AND_EQUAL_U1 0x56
#define EC_OR_EQUAL_U8 0x57
#define EC_OR_EQUAL_U4 0x58
#define EC_OR_EQUAL_U2 0x59
#define EC_OR_EQUAL_U1 0x5A
#define EC_XOR_EQUAL_U8 0x5B
#define EC_XOR_EQUAL_U4 0x5C
#define EC_XOR_EQUAL_U2 0x5D
#define EC_XOR_EQUAL_U1 0x5E
#define EC_ADD_EQUAL_U8 0x5F
#define EC_ADD_EQUAL_U4 0x60
#define EC_ADD_EQUAL_U2 0x61
#define EC_ADD_EQUAL_U1 0x62
#define EC_SUB_EQUAL_U8 0x63
#define EC_SUB_EQUAL_U4 0x64
#define EC_SUB_EQUAL_U2 0x65
#define EC_SUB_EQUAL_U1 0x66
#define EC_ADD64 0x67
#define EC_ADD32 0x68
#define EC_ADD8 0x69
#define EC_INC 0x6A
#define EC_SUB64 0x6B
#define EC_SUB32 0x6C
#define EC_SUB8 0x6D
#define EC_DEC 0x6E
#define EC_ENTER 0x6F
#define EC_LEAVE 0x70
#define EC_ADD_RSP64 0x71
#define EC_ADD_RSP32 0x72
#define EC_ADD_RSP8 0x73
#define EC_RET 0x74
#define EC_CALL 0x75
#define EC_CALL_INDIRECT 0x76
#define EC_CALL_INDIRECT2 0x77
#define EC_IRQ 0x78
#define EC_CLI 0x79
#define EC_STI 0x7A
#define EC_GET_FLAGS 0x7B
#define EC_SET_FLAGS 0x7C
#define EC_GET_BASE_PTR 0x7D
#define EC_SET_BASE_PTR 0x7E
#define EC_GET_STACK_PTR 0x7F
#define EC_SET_STACK_PTR 0x80
#define EC_GET_LABEL 0x81
#define EC_ABSOLUTE_ADDRESS 0x82
#define EC_LABEL 0x83
#define EC_TYPE 0x84
#define EC_BT 0x85
#define EC_BTS 0x86
#define EC_BTR 0x87
#define EC_BTC 0x88
#define EC_BSF 0x89
#define EC_BSR 0x8A
#define EC_INSQUE 0x8B
#define EC_INSQUE_REV 0x8C
#define EC_REMQUE 0x8D
#define EC_MEMCPY 0x8E
#define EC_MEMSET 0x8F
#define EC_INPD 0x90
#define EC_INPW 0x91
#define EC_INP 0x92
#define EC_OUTPD 0x93
#define EC_OUTPW 0x94
#define EC_OUTP 0x95
#define EC_REP_INSW 0x96
#define EC_REP_INSB 0x97
#define EC_REP_OUTSW 0x98
#define EC_REP_OUTSB 0x99
#define EC_JMP 0x9A
#define EC_SHORT_JMP 0x9B
#define EC_SWITCH 0x9C
#define EC_SKIPZ 0x9D
#define EC_SKIPZ2 0x9E
#define EC_SKIPNZ 0x9F
#define EC_SKIPNZ2 0xA0
#define EC_EQUAL_EQUAL_SKIPZ 0xA1
#define EC_EQUAL_EQUAL_SKIPZ2 0xA2
#define EC_NOT_EQUAL_TO_SKIPZ 0xA3
#define EC_NOT_EQUAL_TO_SKIPZ2 0xA4
#define EC_LESS_THAN_SKIPZ 0xA5
#define EC_LESS_THAN_SKIPZ2 0xA6
#define EC_GREATER_THAN_SKIPZ 0xA7
#define EC_GREATER_THAN_SKIPZ2 0xA8
#define EC_LESS_OR_EQUAL_SKIPZ 0xA9
#define EC_LESS_OR_EQUAL_SKIPZ2 0xAA
#dABine EC_GREATER_OR_EQUAL_SKIPZ 0xAB
#dACine EC_GREATER_OR_EQUAL_SKIPZ2 0xAC
#define EC_AND_AND_SKIPZ 0xAD
#define EC_AND_AND_SKIPZ2 0xAE
#define EC_AND_AND_SKIPNZ 0xAF
#define EC_AND_AND_SKIPNZ2 0xB0
#define EC_OR_OR_SKIPZ 0xB1
#define EC_OR_OR_SKIPZ2 0xB2
#define EC_OR_OR_SKIPNZ 0xB3
#define EC_OR_OR_SKIPNZ2 0xB4
#define EC_FILD 0xB5
#define EC_FISTP 0xB6
#define EC_FLD 0xB7
#define EC_FSTP 0xB8
#define EC_FYL2X 0xB9
#define EC_FABS 0xBA
#define EC_FCHS 0xBB
#define EC_FSIN 0xBC
#define EC_FCOS 0xBD
#define EC_FPTAN 0xBE
#define EC_FPATAN 0xBF
#define EC_FSQRT 0xC0
#define EC_FMULP 0xC1
#define EC_FDIVP 0xC2
#define EC_FDIVRP 0xC3
#define EC_FADDP 0xC4
#define EC_FSUBP 0xC5
#define EC_FSUBRP 0xC6
#define EC_LEA_DISP32_RBP 0xC7
#define EC_LEA_DISP8_RBP 0xC8
#define EC_FS_U8_DISP32 0xC9
#define EC_FS_U4_DISP32 0xCA
#define EC_FS_U2_DISP32 0xCB
#define EC_FS_U1_DISP32 0xCC
#define EC_SHL_CONST1 0xCD
#define EC_SHL_CONST2 0xCE
#define EC_SHR_CONST1 0xCF
#define EC_SHR_CONST2 0xD0
#define EC_U8_DISP32_SCALED 0xD1
#define EC_U4_DISP32_SCALED 0xD2
#define EC_U2_DISP32_SCALED 0xD3
#define EC_STRLEN 0xD4
#define EC_ZERO 0xD5
#define EC_NUM_ENTRIES 0xD6
Binary file not shown.
+26
View File
@@ -0,0 +1,26 @@
/*
LoseThos has a feature that allows
access to bytes and words of larger
integers.
See $LK,"U8i union","FF:::/LT/OSMain/AdamK.HPZ,U8i union"$
The versions with "i" are internal data types.
Use "U8" instead of "U8i" and you
will have access to subbytes and
subwords.
*/
U8 q=0xFEDCBA9876543210,q1;
PrintF("q\t\t=%016X\r\n",q);
q1=q.i2[2];
PrintF("q.i2[2]\t\t=%016X\r\n",q1);
q1=q.u1[5];
PrintF("q.u1[5]\t\t=%016X\r\n",q1);
q1=q.i4[1].u1[2];
PrintF("q.i4[1].u1[2]\t=%016X\r\n",q1);
q1=q.i4[0].i1[1];
PrintF("q.i4[0].i1[1]\t=%016X\r\n",q1);
Binary file not shown.
+19
View File
@@ -0,0 +1,19 @@
// COM port Terminal
void CommTerm(I8 port=1,U8 baud=9600)
{
U8 sc;
U8 ch=0;
coutln "ESC to exit";
CommOpen8N1(port,baud);
while (ch!=CH_ESC) {
if (CommScanChar(port,&ch))
PutChar(ch);
ch=0;
if (ScanKey(&ch,&sc))
CommPutChar(port,ch);
SwapInNext;
}
CommClose(port);
}
CommTerm;
+68
View File
@@ -0,0 +1,68 @@
#define DB_FILENAME "HOME/DataBaseDemo.BIN"
#define DB_MAX_ACCOUNT 100
#define DB_ACCOUNT_BLKS 1
class Account
{ //Use $FG,2$CTRL-L$FG$ to help generate $FG,2$fmtstr$FG$s.
I1 name[32] fmtstr "$$DA-P,32,\"Name:%s\"$$\r\n";
I1 address[64] fmtstr "$$DA-P,64,\"Address:%s\"$$\r\n";
U1 pad[DB_ACCOUNT_BLKS*BLK_SIZE-64-32];
};
void InitDatabase()
{
LTFile *f;
//Write new contiguous file
f=FOpen(DB_FILENAME,"wc",DB_MAX_ACCOUNT*DB_ACCOUNT_BLKS);
FClose(f);
}
void WriteAcct()
{
LTFile *f;
Account a;
I8 acctnum;
acctnum=PmtI8("Account #",-1);
if (acctnum>=0 && acctnum<DB_MAX_ACCOUNT) {
MemSet(&a,0,BLK_SIZE);
if (DoForm(&a,"Account")) {
f=FOpen(DB_FILENAME,"w+");
FWBlks(f,&a,acctnum*DB_ACCOUNT_BLKS,DB_ACCOUNT_BLKS);
FClose(f);
}
}
}
void ReadAcct()
{
LTFile *f;
Account a;
I8 acctnum;
acctnum=PmtI8("Account #",-1);
if (acctnum>=0 && acctnum<DB_MAX_ACCOUNT) {
f=FOpen(DB_FILENAME,"r");
FRBlks(f,&a,acctnum*DB_ACCOUNT_BLKS,DB_ACCOUNT_BLKS);
FClose(f);
ClassRep("Account",&a);
}
}
void DatabaseDemo()
{
I1 ch;
if (!FindFile(DB_FILENAME))
InitDatabase;
do {
cout "$$FG,GREEN$$R$$FG$$ead or $$FG,GREEN$$W$$FG$$rite account:";
ch=ToUpper(GetChar);
CrLf;
if (ch=='R') ReadAcct;
if (ch=='W') WriteAcct;
} while (ch!=CH_CTRLQ && ch!=CH_ESC);
}
DatabaseDemo;
+34
View File
@@ -0,0 +1,34 @@
/*
An $LK,"LTDate","MN:LTDate"$ is a signed 64-bit date/time number
representing how many 49710ths of a second
since Christ. The reason it is this crazy
number is so that 32bits is exactly one day.
These numbers can be subtracted to get time
differences.
The time of day to the nearest 49710ths of a second
is stored in the lower 32-bits. The upper
32-bits hold the number of days since Christ.
$LK,"PrintF","MN:PrintF"$() and the file datetimes use
this format, otherwise you might want to
use $LK,"GetTimeStamp","MN:GetTimeStamp"$() for a higher frequency
timing, divide by $LK,"time_stamp_freq","MN:time_stamp_freq"$,
but this number is tied to your CPU's
clock frequency which is inexact when
converted to real-time.
*/
LTDate d=GetCurTimeLTDate;
I8 i;
for (i=0;i<48;i++)
PrintF("%%h%dD: %h*D\r\n",i,i,d);
CrLf;
for (i=0;i<20;i++)
PrintF("%%h%dT: %h*T\r\n",i,i,d);
PrintF("$$FG,PURPLE$$LTDate freq:%12.6f$$FG$$\r\n",0x100000000/24.0/60.0/60.0);
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+348
View File
@@ -0,0 +1,348 @@
//$FG,4$You probably want to avoid
$FG$//$FG,4$three dimensional graphics because
$FG$//$FG,4$support is not very good. There
$FG$//$FG,4$is no support for hidden surface
$FG$//$FG,4$removal.$FG$
#define MAP_WIDTH 1024
#define MAP_HEIGHT 1024
#define MAP_SCALE 20
#define FORSHORTENING 100
#define CONTROLS_SCALE 0.05
#define COORDINATE_SCALE 256
#define COORDINATE_BITS 8
I2 elevations[MAP_HEIGHT][MAP_WIDTH];
double
phi =-45.0*pi/180.0,
theta1= 0.0*pi/180.0,
theta2= 0.0*pi/180.0,
speed = 0.2;
I8 x=MAP_WIDTH>>1 *COORDINATE_SCALE*MAP_SCALE,
y=MAP_HEIGHT>>1*COORDINATE_SCALE*MAP_SCALE,
z=64 *COORDINATE_SCALE*MAP_SCALE;
double grid_size=64.0;
class MPCtrl {
double phi,theta1,theta2,grid_size;
I8 x,y,z;
BoolU4 update,done;
TssStruct *win_tss;
};
MPCtrl *mp;
void InitMap()
{
I8 i,j,k1,k2,x,y,xx,yy;
MemSet(elevations,0,sizeof(elevations));
for (i=0;i<10000;i++) {
x=RandU4%MAP_WIDTH;
y=RandU4%MAP_HEIGHT;
j=1<<(RandU4%6);
for (k1=-j;k1<=j;k1++)
for (k2=-j;k2<=j;k2++) {
xx=x+k2; yy=y+k1;
if (xx>=0 && xx<MAP_WIDTH &&
yy>=0 && yy<MAP_HEIGHT)
elevations[yy][xx]+=AbsI8(j-k1)+AbsI8(j-k2);
}
}
xx=x/MAP_SCALE/COORDINATE_SCALE;
yy=y/MAP_SCALE/COORDINATE_SCALE;
z+=elevations[yy][xx]*COORDINATE_SCALE;
}
void DrawIt(TssStruct *tss)
{
I8 i,j,*r1,*r2,*r3,*r4,*r,x1,y1,z1,x2,y2,z2,xx,yy,grid_s,
cx=(tss->win_pixel_right-tss->win_pixel_left)>>1,
cy=(tss->win_pixel_bottom-tss->win_pixel_top)>>1,height;
double d;
GrBitMap *base=GrAlias(grbase2,tss);
I1 buf[128];
BoolU4 first;
//Adjust grid size to utilize whole CPU power
d=1.05*win_refresh/win_max_refresh;
if (d>1.5) d=1.5;
if (d<0.666666) d=0.666666;
grid_size*=0.975+0.025*d;
if (grid_size<10.0)
grid_size=10.0;
grid_s=grid_size;
//Pass stuff to other CPU
mp->phi=phi;
mp->theta1=theta1;
mp->theta2=theta2;
mp->x=x;
mp->y=y;
mp->z=z;
mp->update=TRUE;
mp->grid_size=grid_size;
xx=x/MAP_SCALE/COORDINATE_SCALE;
yy=y/MAP_SCALE/COORDINATE_SCALE;
height=z/COORDINATE_SCALE-elevations[yy][xx];
if (height<0)
Sound(1000); //Signal plane crashed
base->color=BLACK;
ClearWinText(tss);
SPrintF(buf,"Theta1:%5.1f Phi:%5.1f Theta2:%5.1f Box:%5.1f",
theta1*180/pi,phi*180/pi,theta2*180/pi,grid_size);
GrText(base,0,0,buf);
SPrintF(buf,"x:%5.1f y:%5.1f z:%5.1f height:%3d",
x*1.0/COORDINATE_SCALE,y*1.0/COORDINATE_SCALE,z*1.0/COORDINATE_SCALE,
height);
GrText(base,0,FONT_HEIGHT,buf);
//World to screen coordinates
r1=GrTheta(theta1);
r2=GrPhi(phi);
r3=GrTheta(theta2);
r4=GrMulMat(r1,r2);
r=GrMulMat(r4,r3);
Free(r1);
Free(r2);
Free(r3);
Free(r4);
base->pen_width=2;
base->color=BLACK;
GrLine3(base,cx+5,cy,0,cx-5,cy,0);
GrLine3(base,cx,cy+5,0,cx,cy-5,0);
base->color=GREEN;
x2=0;y2=0;z2=0;
for (i=yy-grid_s;i<yy+grid_s;i++) {
if (i>=0 && i<MAP_HEIGHT) {
first=TRUE;
for (j=xx-grid_s;j<xx+grid_s;j++) {
if (j>=0 && j<MAP_WIDTH) {
x1=j*MAP_SCALE-x>>COORDINATE_BITS;
y1=i*MAP_SCALE-y>>COORDINATE_BITS;
z1=elevations[i][j]-z>>COORDINATE_BITS;
GrRotate(r,&x1,&y1,&z1);
if (z1<0) {
z1=AbsI8(z1)+FORSHORTENING;
x1=x1*FORSHORTENING/z1;
y1=y1*FORSHORTENING/z1;
if (!first)
GrLine(base,x1+cx,cy-y1,x2+cx,cy-y2);
}
x2=x1;y2=y1;z2=z1;
first=FALSE;
}
}
}
}
Free(r);
GrDel(base);
}
void MPDrawIt(MPCtrl *mp)
{
TssStruct *tss=mp->win_tss;
I8 i,j,*r1,*r2,*r3,*r4,*r,x1,y1,z1,x2,y2,z2,xx,yy,
cx=(tss->win_pixel_right-tss->win_pixel_left)>>1,
cy=(tss->win_pixel_bottom-tss->win_pixel_top)>>1;
GrBitMap *base=GrAlias(Gs->grbase,Fs);
BoolU4 first;
I8 x=mp->x,y=mp->y,z=mp->z,grid_s=mp->grid_size;
base->win_tss=tss;
xx=x/MAP_SCALE/COORDINATE_SCALE;
yy=y/MAP_SCALE/COORDINATE_SCALE;
//World to screen coordinates
r1=GrTheta(mp->theta1);
r2=GrPhi(mp->phi);
r3=GrTheta(mp->theta2);
r4=GrMulMat(r1,r2);
r=GrMulMat(r4,r3);
Free(r1);
Free(r2);
Free(r3);
Free(r4);
GrClear(base);
base->color=GREEN^WHITE;
x2=0;y2=0;z2=0;
for (j=xx-grid_s;j<xx+grid_s;j++) {
if (j>=0 && j<MAP_WIDTH) {
first=TRUE;
for (i=yy-grid_s;i<yy+grid_s;i++) {
if (i>=0 && i<MAP_HEIGHT) {
x1=j*MAP_SCALE-x>>COORDINATE_BITS;
y1=i*MAP_SCALE-y>>COORDINATE_BITS;
z1=elevations[i][j]-z>>COORDINATE_BITS;
GrRotate(r,&x1,&y1,&z1);
if (z1<0) {
z1=AbsI8(z1)+FORSHORTENING;
x1=x1*FORSHORTENING/z1;
y1=y1*FORSHORTENING/z1;
if (!first)
GrLine(base,x1+cx,cy-y1,x2+cx,cy-y2);
}
x2=x1;y2=y1;z2=z1;
first=FALSE;
}
}
}
}
Free(r);
GrDel(base);
}
void MPFSim()
{
while (!mp->done) {
while (!mp->update && !mp->done)
SwapInNext;
MPDrawIt(mp);
mp->update=FALSE;
}
GrClear(Gs->grbase);
mp->done=FALSE;
}
void AnimateTsk()
{
I8 *r1,*r2,*r3,*r4,*r,x1,y1,z1;
while (TRUE) {
//Screen to world coordinates
r1=GrTheta(-theta2);
r2=GrPhi(-phi);
r3=GrTheta(-theta1);
r4=GrMulMat(r1,r2);
r=GrMulMat(r4,r3);
x1=0;y1=0;z1=-1.0*speed*COORDINATE_SCALE;
GrRotate(r,&x1,&y1,&z1);
x+=x1;
y+=y1;
z+=z1;
Free(r1);
Free(r2);
Free(r3);
Free(r4);
Free(r);
Sleep(1);
}
}
void SongEndTsk()
{
Sound(0);
Exit;
}
void SongTsk()
{
Fs->end_task_cb=&SongEndTsk;
ResetMusicSettings;
while (TRUE) {
Play("3etDCDqDetABFsFBFBqC2G3BeDF");
Play("etDCDqDetABFsFBFBqC2G3BeDF");
Play("qReFDqDeF2GqR3sABABqFetREA");
Play("qReFDqDeF2GqR3sABABqFetREA");
}
}
void EndFSim()
{
mp->done=TRUE;
while (mp->done)
SwapInNext;
FreeHC(mp,mp_heap);
}
void EndFSimCB()
{
//We need this to shut-down CPU#1 task
//in case of CPU0 task getting terminated
//irregularly.
EndFSim;
Exit;
}
void FlightSim()
{
I8 ch,sc;
double pp,tt1,tt2;
void *old_update=Fs->update_win;
TssStruct *animate_tss,song_tss;
BoolU4 old_border=WinBorder(OFF);
BoolU4 old_wordstat=WordStat(OFF);
//Set callback for irregular aborts
Fs->end_task_cb=&EndFSimCB;
WinMax;
InitMap;
Fs->update_win=&DrawIt;
animate_tss=Spawn(&AnimateTsk,"FlightSim Animate",Fs);
song_tss=Spawn(&SongTsk,"FlightSim Song",Fs);
//This heap is uncached
mp=MAllocHCZ(sizeof(MPCtrl),mp_heap);
WbInvd; //Write mp out of cache
mp->win_tss=Fs;
if (mp_cnt>1)
MPQueueJob(&MPFSim,NULL,1<<MPCf_FREE_ON_COMPLETE,TRUE);
try
do {
ch=GetKey(&sc);
pp=phi; tt1=theta1; tt2=theta2;
switch (ch) {
case 0:
switch (sc.u1[0]) {
case SC_CURSOR_DOWN:
phi +=-CONTROLS_SCALE*Cos(tt1);
theta2+=-CONTROLS_SCALE*Sin(tt1)*Sin(phi);
break;
case SC_CURSOR_UP:
phi -=-CONTROLS_SCALE*Cos(tt1);
theta2-=-CONTROLS_SCALE*Sin(tt1)*Sin(phi);
break;
case SC_CURSOR_RIGHT:
theta1+=CONTROLS_SCALE;
break;
case SC_CURSOR_LEFT:
theta1-=CONTROLS_SCALE;
break;
}
break;
}
theta1=Unwrap(theta1);
phi =Unwrap(phi);
theta2=Unwrap(theta2);
} while (ch!=CH_CTRLQ && ch!=CH_ESC);
catch
Fs->catch_except=TRUE;
Kill(animate_tss);
Kill(song_tss);
Fs->update_win=old_update;
Fs->end_task_cb=NULL;
WinBorder(old_border);
WordStat(old_wordstat);
EndFSim;
}
FlightSim;
Binary file not shown.
Binary file not shown.
Binary file not shown.
+56
View File
@@ -0,0 +1,56 @@
class DStruct
{ //Use CTRL-L and select "Data" to generate the format strs
double num1 fmtstr "$$DA-T,256,\"Double 1:%12.8f\"$$\r\n";
double num2 fmtstr "$$DA-T,256,\"Double 2:%12e\"$$\r\n";
I8 num3 fmtstr "$$DA-T,256,\"I8 1:0x%08X\"$$\r\n";
I8 num4 fmtstr "$$DA-T,256,\"I8 2:%12d\"$$\r\n";
I1 name[8] fmtstr "$$DA-P,7, \"Name :%s\"$$\r\n";
LTDate dt fmtstr "$$DA-T,256,\"Date :%8D\"$$\r\n";
};
public void DoIt()
{
double d;
I8 i;
I1 *name;
DStruct gtl;
LTDate datetime;
gtl.num1=12.3e-4; //Set defaults
gtl.num2=4.5e3;
gtl.num3=0x1234;
gtl.num4=-567;
StrCpy(&gtl.name,"John");
datetime=GetCurTimeLTDate;
gtl.dt=datetime;
if (DoForm(&gtl,"DStruct")) {
coutln "#1=",gtl.num1;
coutln "#2=",gtl.num2;
coutln "#3=",gtl.num3;
coutln "#4=",gtl.num4;
coutln "Name=",gtl.name;
PrintF("Date=%D\r\n",gtl.dt);
} else
coutln "Cancel";
coutln "\r\n\r\nClassRep Example";
ClassRep("DStruct",&gtl);
coutln "\r\n\r\nNow prompting from the cmd line:";
i=PmtI8("Enter int (%d):",123);
coutln "Int=",i;
d=PmtDouble("Enter double (%12g):",1.2e3);
coutln "Double=",d;
name=PmtStr("Name (%s):","John");
coutln "Name:",name;
Free(name);
datetime=PmtLTDate("Date (%D):",GetCurTimeLTDate);
PrintF("Date=%D\r\n",datetime);
}
DoIt;
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+38
View File
@@ -0,0 +1,38 @@
U1 *old_font=grfont;
// See $LK,"::/LT/OSMain/Font8x8.CPZ","FI:::/LT/OSMain/Font8x8.CPZ"$
U1 waves[8*4]={
0x00,0x11,0xAA,0x44,0x00,0x11,0xAA,0x44,
0x00,0x22,0x55,0x88,0x00,0x22,0x55,0x88,
0x00,0x44,0xAA,0x11,0x00,0x44,0xAA,0x11,
0x00,0x88,0x55,0x22,0x00,0x88,0x55,0x22};
void AnimateEnd()
{
grfont=old_font;
Exit;
}
void AnimateTsk()
{
U8 i;
U1 *font=MAlloc(256*8);
Fs->end_task_cb=&AnimateEnd;
MemCpy(font,grfont,256*8);
grfont=font;
while (TRUE) {
MemCpy(font+CH_SPACE*FONT_HEIGHT,waves+8*(i++&0x3),8);
Sleep(100);
}
}
Spawn(&AnimateTsk,"Animate Font Task");
TaskRep;
/*
Note: You cannot redefine the zero
or space (0x20) characters.
*/
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+98
View File
@@ -0,0 +1,98 @@
I1 *BootTimeCB(Ltf *l,LtfEntry *ll,TssStruct *mem_tss)
{
LTDate i;
//$FG,2$This routine is called by the window
$FG$//$FG,2$manager things would get corrupted
$FG$//$FG,2$if the window manager used it's own
$FG$//$FG,2$heap, so we use the owning task's heap.$FG$
I1 *st=MAlloc(64,mem_tss);
nounusedwarn l,ll;
i=BootTime;
//$FG,2$Doesn't have to be fixed width!!$FG$
SPrintF(st,"%d=%h11T",i,i);
return st;
}
I1 *CurTimeCB(Ltf *l,LtfEntry *ll,TssStruct *mem_tss)
{
LTDate i;
I1 *st=MAlloc(64,mem_tss);
nounusedwarn l,ll;
i=GetCurTimeLTDate;
SPrintF(st,"%h0D %h0T",i,i);
return st;
}
void DoIt()
{
/*$FG,2$ The main window is kept at $FG,4$Fs->cur_ltf$FG,2$.
A second framework is kept at $FG,4$Fs->aux_ltf$FG,2$.
Normally, the $FG,4$aux_ltf$FG,2$ is used for updating
the border, primarily.
See $LK,"UseConsoleLtf","MN:UseConsoleLtf"$().
See $LK,"LtfUpdateBothLtf","MN:LtfUpdateBothLtf"$().
Note: the $FG,4$aux_ltf$FG,2$ is not to be confused
with the $FG,4$aux_str$FG,2$, a member of the $LK,"LtfEntry","MN:LtfEntry"$.
$FG$*/
Ltf *aux=Fs->aux_ltf,
*cur=Fs->cur_ltf;
LtfEntry *ll;
// $FG,2$We don't want an update between
$FG$// $FG,2$creating the LtfEntry and defining the
$FG$// $FG,2$callback, so we turn-off preemption.$FG$
BoolU4 old_preempt=Preempt(OFF);
LtfBottom(aux); //$FG,2$Insert at the bottom$FG$
LtfPutSExt(aux,"$$FG,RED$$$$CM+BY+LX,5,-3$$");
//$FG,2$ The $LK,"LtfPutSExt","MN:LtfPutSExt"$() routine returns the address of the last entry.$FG$
ll=LtfPutSExt(aux,"$$TX+DC,\" \"$$");
$FG$// $FG,2$The $FG,4$DC$FG,2$ flag is "has display callback".
$FG$
//$FG,2$ Flags are explained here:
$FG$// $LK,"::/LT/Doc/CtrlL.MUZ","FI:::/LT/Doc/CtrlL.MUZ"$
// $LK,"::/LT/Doc/Dollar.TXZ","FI:::/LT/Doc/Dollar.TXZ"$
// $LK,"Dollar Flags","MN:LTFLf_AUX_STR"$
// $LK,"ST_LTF_FLAGS","FF:::/LT/OSMain/SysText.CPZ,ST_LTF_FLAGS"$
ll->display_cb=&BootTimeCB;
LtfPutSExt(aux,"$$FG$$");
//$FG,2$$BK,1$WARNING:$BK,0$ If you use the $FG,4$cur_ltf$FG,2$ you
$FG$//$FG,2$run the risk of the user pressing
$FG$//$FG,2$$FG,4$CTRL-T$FG,2$ or using the clipboard, both
$FG$//$FG,2$of which will crash. So, you might want
$FG$//$FG,2$to use the $FG,4$aux_ltf$FG,2$.
$FG$
LtfPutSExt(cur,"$$FG,LTRED$$");
ll=LtfPutSExt(cur,"$$TX+DC,\" \"$$");
$FG$ ll->display_cb=&CurTimeCB;
LtfPutSExt(cur,"$$FG$$");
Preempt(old_preempt);
//$FG,2$Send carriage return, new line, so
$FG$//$FG,2$that the timer string is not part
$FG$//$FG,2$of the next command on the command line.
$FG$ CrLf;
}
void UndoIt()
{
//$FG,2$Clear-out entries without a $FG,4$+H$FG,2$ hold flag.$FG$
LtfBottom(Fs->aux_ltf);
LtfPutSExt(Fs->aux_ltf,"$$CL$$");
}
DoIt;
BIN
View File
Binary file not shown.
+15
View File
@@ -0,0 +1,15 @@
void MsgLoop()
{
U8 p1=0,p2=0,cmd=0;
coutln "Use $$LK \"these\",\"MN:MSG_CMD\"$$ defines "
"in your programs instead of hardcoded numbers.";
coutln "Press ESC to Exit";
while (cmd!=MSG_KEY_DOWN || (p1!=CH_ESC && p1!=CH_CTRLQ)) {
cmd=GetMsg(&p1,&p2,-2);
// The following fixes the cursor position
LtfBottom(Fs->cur_ltf);
PrintF("CMD:%02X P1:%08X P2:%08X\r\n",cmd,p1,p2);
}
}
MsgLoop;
+94
View File
@@ -0,0 +1,94 @@
/*
This demo uses some memory which is
uncached and can be accessed by
both CPU's.
See $LK,"Memory","HI:Memory"$
*/
class XferCtrl
{
BoolU4 done;
I1 buf[512];
I8 cnt;
TssStruct *song_tsk;
};
XferCtrl *xc;
void SongEndTsk()
{
Sound(0);
Exit;
}
void SongTsk()
{
Fs->end_task_cb=&SongEndTsk;
ResetMusicSettings;
while (TRUE) {
Play("3qG2G3DBsDCDCqRCG");
Play("G2G3DBsDCDCqRCG");
Play("EeGFqBBDA2eGGqR");
Play("3EeGFqBBDA2eGGqR");
}
}
void CPU1Tsk1()
{
Preempt(ON);
xc->song_tsk=Spawn(&SongTsk,"MultiCore Song");
while (!xc->done) {
SPrintF(xc->buf,"Hi %d",xc->cnt);
SPrintF(xc->buf,"Low %d",xc->cnt);
xc->cnt++;
}
xc->done=FALSE;
}
void CPU1Tsk2()
{
Preempt(ON);
Kill(xc->song_tsk);
while (!xc->done) {
SPrintF(xc->buf,"Up %d",xc->cnt);
SPrintF(xc->buf,"Down%d",xc->cnt);
xc->cnt--;
}
xc->done=FALSE;
}
void CPU0Tsk()
{
//$FG,2$Allocate off of the write-through heap$FG$
xc=MAllocHC(sizeof(XferCtrl),mp_heap);
WbInvd; //$FG,2$Flush xc out of Cache.$FG$
xc->cnt=0;
xc->done=FALSE;
*xc->buf=0;
MPQueueJob(&CPU1Tsk1);
while (!ScanKey) {
coutln xc->cnt,":",xc->buf;
SwapInNext;
}
xc->done=TRUE;
while (xc->done)
SwapInNext;
MPQueueJob(&CPU1Tsk2);
while (!ScanKey) {
coutln xc->cnt,":",xc->buf;
SwapInNext;
}
xc->done=TRUE;
while (xc->done)
SwapInNext;
FreeHC(xc,mp_heap);
}
CPU0Tsk;
Binary file not shown.
Binary file not shown.
+35
View File
@@ -0,0 +1,35 @@
void SongEndTsk()
{
Sound(0);
Exit;
}
void SongTsk()
{
//See $LK,"Play","MN:Play"$() for notation.
Preempt(ON);
//Define a end-task call back so
//the sound will stop if the
//window is closed.
Fs->end_task_cb=&SongEndTsk;
ResetMusicSettings;
while (TRUE) {
Play("1wCqDsEFG2AB");
Play("wCqDsEFG3AB");
Play("wCqDsEFG4AB");
Play("wCqDsEFG5AB");
Play("wCqDsEFG6AB");
}
}
Spawn(&SongTsk,"Background Song");
coutln "$$FG,PURPLE$$A task has been spawned to "
"play music in the background.";
coutln "Use $$LK,\"TaskRep\",\"MN:TaskRep\"$$() to "
"kill it.$$FG$$";
Auto("TaskRep;\r"); //Make it visible so people see the name, TaskRep
Binary file not shown.
+18
View File
@@ -0,0 +1,18 @@
/*
$FG,2$$WW,1$This gets a list of files, flattens the list from a tree into an array and sorts them by cluster number, to speed-up access time by avoiding moving the disk head around.
$WW,0$$FG$*/
void DoIt()
{
I8 i,cnt=0;
LTDirEntry *tempm=FindFiles("::/LT/*",1<<FUf_RECURSE),
**a=OrderFiles(tempm,&cnt);
for (i=0;i<cnt;i++) {
PrintF("%08X %s\r\n",a[i]->cluster,a[i]->full_name);
DelLTDirEntry(a[i]);
}
Free(a);
}
DoIt;
+23
View File
@@ -0,0 +1,23 @@
void Spy(TssStruct *tss)
{
Ltf *swap,*menu=Fs->cur_ltf->menu_ltf;
BoolU4 old_preempt=Preempt(OFF);
SysHashTable *old_hash=Fs->hash_table;
Fs->cur_ltf->menu_ltf=NULL;
Fs->hash_table=tss->hash_table;
Fs->double_buf_cur_ltf=LtfNew;
while (!ScanKey) {
LtfDel(Fs->cur_ltf);
Fs->cur_ltf=LtfNew;
StackRep(tss->rsp);
swap=Fs->double_buf_cur_ltf;
Fs->double_buf_cur_ltf=Fs->cur_ltf;
Fs->cur_ltf=swap;
WinSync;
}
LtfDel(Fs->double_buf_cur_ltf);
Fs->double_buf_cur_ltf=NULL;
Fs->hash_table=old_hash;
Fs->cur_ltf->menu_ltf=menu;
Preempt(old_preempt);
}
+82
View File
@@ -0,0 +1,82 @@
//Change anything you want in this
//account file or others.
local_time_offset=-7*60*60*LTDATE_FREQ;
//$AN,"","mouse_move_scale"$adjust these to set mouse move scale
mxx_scale=1.0;
myy_scale=1.0;
mzz_scale=1.0; //wheel
//don't change these
mxx_prescale=mxx/mxx_scale;
myy_prescale=myy/myy_scale;
mzz_prescale=mzz/mzz_scale;
MPStart;
Cd("/LT/Adam");;
#include "PicWords2"
#include "HOME/PicWords3"
Cd("/LT/Utils/Boot");;
#include "InsBoot"
Cd("/LT/Utils");;
#include "Disk20"
#include "Diff"
#include "Grep"
#include "Merge"
#include "S2T"
#include "IDE"
#include "LinkChk"
#include "HeapLog"
#include "ListFile"
LoadMapFile("::/LT/OSMain/OS.MPZ"); //Enable Man()
LoadMapFile("::/LT/Compiler/Compiler.MPZ"); //Enable Man()
LoadMapFile("::/LT/Adam/GrAsm/GrAsm.MPZ"); //Enable Man()
Cd("/LT/Apps");;
#include "TimeClock/Load.CPZ"
#include "MusicOrgan/Load.CPZ"
Cd("/LT/Accts/TAD");;
#include "HOME/Private/Adam4"
#include "TADAdam"
#include "Distribute"
#include "PlugIns"
Cd("/LT/Accts/TAD/Testing");;
#include "Compiler5"
Cd("/LT/Accts/TAD/BenchMarks");;
#include "CompareCmp"
Del("::/Temp/ScreenShots/*");
void StartUpTsks()
{
I1 buf[80];
TssStruct *tss,*tss1;
InitLocalTask; //needed for disk access
Preempt(ON); //off by default
Silent(ON); //no output to screen
try {
tss1=SpawnUser;
tss=SpawnUser;
WinToTop(tss1);
WinTileVert;
PopUp("#include \"::/LT/Doc/StartSong.CPZ\";");
SPrintF(buf,"Boot Time:%h17Ts\r\n",BootTime);
AdamLog(buf);
XTalk(tss1,"#include \"DoIt\";\r");
WsInit("/LT");
WordStat;
AdamLog("WordStat Time:%7.3f\r\n",BootTime*1.0/LTDATE_FREQ);
} catch
CatchAll;
}
//This must be spawned because start-up files
// may invoke the Adam() cmd.
Spawn(&StartUpTsks,"Spawn Users");
PrintF("\r\nOS Compile Time:%D %T\r\n",sys_compile_time,sys_compile_time);
Binary file not shown.
Binary file not shown.
+170
View File
@@ -0,0 +1,170 @@
$WW,1$You can access your own TODO/favorites file with CTRL-SHIFT-F.
$TX+TR,""$$BK,1$$FG,4$LEGAL STUFF:$BK,0$$FG$
$ID,2$ This file is where I set my plans. There are no guarentees. I work "iteratively" when programming--often writing bad code to experiment with and later changing it on a priority basis. The order things are listed does not necessarily reflect the order they will be done, if at all--I often do stuff when I'm in the mood.
$ID,-2$$TR-C,"HANDY FILE LINKS"$
$ID,2$
$LK+S,"Goto OS Systext","FA:::/LT/OSMain/SysText.CPZ,OS_SYSTEXT"$
$LK+S,"Goto Compiler Systext","FA:::/LT/Compiler/CmpInit.CPZ,COMPILE_SYSTEXT"$
$LK+S,"::/LT/Doc/News.TXZ","FI:::/LT/Doc/News.TXZ"$
$ID,-2$$TR-C,"THINGS WHICH MIGHT CHANGE"$
$ID,2$
$ID,-2$$TR-C,"HIGH PRIORITY"$
$ID,2$
* document internals of keyboard processing
* I think a partition was left locked after pressing ctrl-alt-c in a copy.
* Dasm OR mode 0D
* Ln(-1.0);
* inline functions?
* Document start,step on clipped lines.
* Penwidth or brush with clipped line
* make popuppickfile/dir with default dir? in registry?
* fix %g, not sure it's worth it--standard seems dumb.
* efficient line clipping
* clipping bug--draw pen_width pixel near border.
* with pen_width of, say, 2... blots a width 8 and checks too far over (IsPixelCovered)
* Better single step--already have $LK,"DasmIns","MN:DasmIns"$() set to return branch offsets. Needs to put breakpoints on all branches outside the current C/C+ source code line. Problem is calls--should open files... whatever
* add compact to ltz--low priority
* Word Wrap has some bugs
* perhaps store ltfentry.display length--low priority (Significant profile time is spent on the StrLen instruction and it could be stored for each text entry.
* fix LTFile with alloccluster. Sorta fixed it--made all LT filesystem files marked contiguous, since they are. Should check what happens when you attempt to $LK,"FWBlks","MN:FWBlks"$() to acluster past the end.
* add compiler routine which you can pass a local-variable list, to provide locals which are globals, for stuff like a spread sheet or something. Might do this to facilitate spread-sheet type applications and things like SimStructure. Might do my budget program. low priority
* Fix dictionary--not sure it's broken, but it's missing words and definitions ?
* log to file--would be ineffecient--load-in whole file, modify and write out. Useful, but not very effecient
* test dvd burning-- It might put CD-ROM format on DVD. I probably need to use DMA, though, to prevent underflow when mutlitasking, but I don't feel like it. Headaches with dma involving compatibility. Missing documentation on DMA.
* CD boots--limit retry, seems to fail sometimes.
* make partitioner round to 63 blks
* make editable partitioner
* Make driveutil with maps and adddrive and partition report
* prtscrn--printer support... is PortNop() a problem?
* rename command
* log filename generator--pick next larger than last logfilenamenum found
* SprintF NaN,Inf; GetF Inf
* GetF date codes
* make grelem insert use l->mem_tss?
* Ltf's not using mem_tss?
$ID,-2$$TR,"DOCUMENTATION"$
$ID,2$
$ID,-2$$TR,"PERPETUAL TASKS"$
$ID,2$* Change hardcoded stuff to SysText
* Too much preemption turned off?
* Look for mem leaks.
* Move stuff out of OSmain.
$TR-C,"COMPATIBILITY"$
$ID,2$* TAD4 CD-ROM doesn't close
* mouse IRQ doesn't work on TAD5.
$ID,-2$$ID,-2$$TR-C,"GRAPHICS"$
$ID,2$* Do something about extended ASCII in fonts.
* skip redundant clipping, line and plot
* SIMD transformation
$ID,-2$$TR,"MULTICORE"$
$ID,2$* move GrElem draw to CPU1?
$ID,-2$$TR,"DISK"$
$ID,2$* Improve ATAPI read-ahead
* Clear unused portion of clusters on disk writes
* try not using FDCreadtrack on Mom's computer
* removable media id (critical for resident files)
* Flash cards: Flash mem cards might offer a removable, bootable media which will enable people to run without repartitioning--floppy is kinda small. DVD doesn't allow writing. Problem with flash is it is not standard equipment on computers. Would be very convenient for developing and distributing operating systems. I think LILO will allow Flash booting.
* Report just one error per read track (Floppy)
$ID,-2$$TR,"FILE"$
$ID,2$* CurDir per partition? Path?
* Make use of flag potential in SysFindFiles and possibly LTFileAccess
* make contiguous flag right
* implement fixed position files
$ID,-2$$TR,"C+ LIBRARY"$
$ID,2$* Improve Random number generator.
* add field overflow I1 "t='*'"
* Integer Money value for printf/getf--in pennies
* Implement format codes into GetF
* Date Input
* flag for comma's in numeric output (printf). eg "1,000,000" instead of "1000000".
$ID,-2$$TR,"APPLICATIONS"$
$ID,2$$ID,-2$$TR,"EDITOR"$
$ID,2$* Might allow constantly centered mode--cursor stays centered on screen(vertically).
* Find jumps past current line
* Make editor find command take dollar signs
* Maybe allow SearchStr flags in Links
* Link Type for SysText document? problem would be differnet needs for indexing into books. Bible uses book,chapter:verse, others are different. Already have links.
* Generalize book links
* HASHTYPE for Book? Index?
* Add write protect mode with indicator and toggle
$ID,-2$$TR,"IDE"$
$ID,2$$ID,-2$$TR,"DEBUGGING"$
$ID,2$* Improve fault handling--has inaccuracies--would be nice to display mem access violation addresses.
$ID,-2$$TR,"ASSEMBLER"$
$ID,2$* 16 bit Dasm is bad--very low priority
* support r4u1 by adding 0x40 byte
$ID,-2$$TR,"COMPILER"$
$ID,2$* something makes $LK,"OptEnd","MN:OptEnd"$ not right
* More RCX_CMPs, check existing
* do r,rm IcCmp like IcBrCmp
* PUSH_CMP allocs reg R9 or whatever
* Might be problem with NOP in OPT pass1 for NO_PUSH in expressions besides assignments. Is ShiftNoPush fully implemented?
$TR,"Check for problems"$
$ID,2$* NOP1 might need to have diff ic_data's
* in divequal, it assumes about ebx
* check union return_class.
$ID,-2$* error/warning line nums
* ASM branch out of range off by 1 line--use lx->lag_line_num
* Switch statement with sparse cases (low priority)
* arbitrary named attributes like "fmtdata" or "fmtstr". Might allow arbitrary supplimental data in class definitions.
* goto labels scope issues?
* No str default function parameters inside $LK,"Static Compiled Mode","FF:::/LT/Doc/OSGlossary.GLZ,Static Compiled Mode"$.
* var declarations after class definitions (Not a priority)
* glbl vars--&function ptrs
$TR,"Optimizations"$
$ID,2$* push pop
* maybe improve floating point compilation.
* new TY_ mode SIB and reg extensions
$ID,-2$$TR,"Picky"$
$ID,2$* !double ~double
* assign I2, etc. should sign extend copyleft
$ID,-2$$ID,-2$$TR,"MEM"$
$ID,2$* Redo mem Garbage collection on task and do one on system... but these don't help, so probably won't do it.
$ID,-2$$TR,"LOW PRIORITY"$
$ID,2$* num lock comes on with break key
* sort options for findfiles
$ID,-2$$TR,"TESTING"$
$ID,2$* Tabs2Spaces
$ID,-2$$TR,"INVESTIGATE"$
$ID,2$*
$ID,-2$$TR,"BUGS"$
$ID,2$
$ID,-2$$TR,"NASTY BUGS"$
$ID,2$*
$ID,-2$$TR,"BUGS WHICH MIGHT EXIST"$
$ID,2$*
$ID,-2$$TR,"BUGS WHICH MIGHT BE FIXED"$
$ID,2$*
$ID,-2$$TR,"MIGHT BE BUGS"$
$ID,2$* recalc_start probably needs to be more accurate before recalculating.
* In LtfPutSExt, might need to alloc extendstr, ect from different heap.
$ID,-2$
$LK,"Bible","BF:Genesis,"$
+254
View File
@@ -0,0 +1,254 @@
void InsertSong()
{
I1 *s1,*s2;
s1=MakeSong;
s2=MakeSong;
PrintF("$$SO,\"\",\"%s%s%s%s\"$$",s1,s1,s2,s2);
Free(s1);
Free(s2);
}
void FillinTime()
{
LTDate ltdt;
ltdt=GetCurTimeLTDate;
PrintF("$$IV 1$$----%D %T----$$IV 0$$\r",ltdt,ltdt);
}
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 MyScreenShot()
{
I1 *st;
LTDirEntry *tempm;
U8 cnt=0;
tempm=FindFiles("::/Temp/ScreenShots/*.BMP");
while (tempm) {
cnt++;
tempm=tempm->next;
}
st=MSPrintF("::/Temp/ScreenShots/SCRN%04d.BMP",cnt);
CaptureScreen4(st);
Free(st);
Beep;
}
BoolU4 frame_grabber_paused=FALSE;
TssStruct *my_frame_grabber=NULL;
void EndFrameGrabberCB()
{
my_frame_grabber=NULL;
Exit;
}
void FrameGrabberTsk()
{
I8 frame_num=0;
I8 buf[80];
U8 i,
end_time=0,
time_stamp=0;
Fs->end_task_cb=&EndFrameGrabberCB;
InitLocalTask;
Silent(ON); //no output to screen
while (my_frame_grabber) {
SPrintF(buf,"::/Temp/ScreenShots/VID%05d.BMP",frame_num++);
CaptureScreen4(buf);
do {
i=GetTimeStamp;
if (i>end_time) {
end_time=i+time_stamp_freq/4;
break;
} else {
SwapInNext;
while (sys_cur_scan_code&SCF_NUM)
SwapInNext;
}
} while (TRUE);
}
}
void ToggleFrameGrabber()
{
if (my_frame_grabber) {
my_frame_grabber=NULL;
kbd_display_special_keys=FALSE;
} else {
my_frame_grabber=Spawn(&FrameGrabberTsk,"Frame Grabber");
kbd_display_special_keys=TRUE;
}
}
BoolU8 MyPutKey(I8 ch,U8 sc)
{ //ch=ASCII; sc=scancode
//You can customize keys. This routine
//is called before the main editor
//key handler $LK,"LtfPutKeyExt","MN:LtfPutKeyExt"$().
//You can intercept any key.
//Return TRUE if you completely
//handled the key.
nounusedwarn ch;
U8 sc2=sc.u1[0];
if (sc2>=SC_F1 && sc2<=SC_F10 &&
(sc & SCF_ALT) &&
!(sc & SCF_CTRL)) {
switch (sc2) {
case SC_F1:
if (sc & SCF_SHIFT)
PutS("$$FG LTPURPLE$$");
else
PutS("$$FG PURPLE$$");
break;
case SC_F2:
if (sc & SCF_SHIFT)
PutS("$$FG LTRED$$");
else
PutS("$$FG,RED$$");
break;
case SC_F3:
if (sc & SCF_SHIFT)
PutS("$$FG LTGREEN$$");
else
PutS("$$FG,GREEN$$");
break;
case SC_F4:
if (sc & SCF_SHIFT)
PutS("$$FG LTBLUE$$");
else
PutS("$$FG$$");
break;
case SC_F5:
if (sc & SCF_SHIFT)
RandQuote;
else
RandWord;
break;
case SC_F6:
if (sc & SCF_SHIFT)
PopUp("WsInit(\"/Text/Brief\");");
else
PopUp("WsInit(\"/LT\");");
break;
case SC_F7:
if (sc & SCF_SHIFT)
LtfSafeInsert(Fs->cur_ltf,
"$$HS+C$$$$FG$$$$HE$$");
else
FillinTime();
break;
case SC_F8:
if (sc & SCF_SHIFT)
RenameFile();
else
RenameCurSymbol();
break;
}
return TRUE;
} else {
if (!(sc & SCF_CTRL)) {
if (ch=='S' && sc & SCF_ALT) {
InsertSong;
return TRUE;
}
if (ch=='p' && sc & SCF_ALT) {
JukeBox("/LT/Apps/MusicOrgan/Examples");
return TRUE;
}
if (ch=='P' && sc & SCF_ALT) {
JukeBox("HOME/BTracks");
return TRUE;
}
if (ch=='f' && sc & SCF_ALT) {
ProfAll;
return TRUE;
}
if (ch=='F' && sc & SCF_ALT) {
ProfRep;
return TRUE;
}
if (ch=='h' && sc & SCF_ALT) {
WinTileHorz; //This is handy
return TRUE;
}
if (ch=='v' && sc & SCF_ALT) {
WinTileVert; //So is this
return TRUE;
}
if (ch=='V' && sc & SCF_ALT) {
ToggleFrameGrabber;
return TRUE;
}
if (ch=='m' && sc & SCF_ALT) {
WinMax;
WinBorder(OFF);
return TRUE;
}
if (ch=='k' && sc & SCF_ALT) {
if (kbd_display_special_keys)
kbd_display_special_keys=FALSE;
else
kbd_display_special_keys=TRUE;
return TRUE;
}
} else {
if (sc2==SC_PRTSCRN2) {
MyScreenShot();
return TRUE;
}
}
}
return FALSE;
}
BoolU8 MyPutS(I1 *st)
{
nounusedwarn st;
return FALSE;
}
AddKeyDev(&MyPutKey,&MyPutS,0x20000000);
+202
View File
@@ -0,0 +1,202 @@
#define CID_TAD7 7
I8 IdComputer()
{
return CID_TAD7;
}
I8 computer_id=IdComputer;
void SysTaskRepTask(TssStruct *tss,I8 indent)
{
TssStruct *tss1;
I1 desc[TSS_DESC_LENGTH+1];
if (!ValidateTss(tss)) return;
SPrintF(desc,"%Q",tss->task_descriptor);
PrintF("%*s%08X %-20ts ",indent,"",tss,desc);
PrintF("Mem:%08X\r\n",TaskAllocatedMem(tss));
PrintF("%*s Flags:%04X:%04X %02X\r\n",
indent+2,"",tss->task_flags,tss->crt_flags,
ExceptDepth(tss));
if (tss==sys_update_screen_tss) {
CallerRep(tss->rbp,tss);
StackRep(tss->rsp);
}
tss1=tss->next_child_tss;
while (tss1!=&tss->next_child_tss-offset(TssStruct.next_sibling_tss)) {
if (ValidateTss(tss1))
SysTaskRepTask(tss1,indent+2);
tss1=tss1->next_sibling_tss;
}
}
public void SysTaskRep()
{
U8 i;
CPUStruct *c;
for (i=0;i<mp_cnt;i++) {
c=mp_cpu_structs+sizeof(CPUStruct)*i;
coutln "CPU:",i;
SysTaskRepTask(c->cain_tss,2);
}
}
void CtrlAltT()
{
BoolU4 old_raw=Raw(ON);
dc_col=0;
SysTaskRep;
Raw(old_raw);
}
ctrl_alt_letter_routines['T'-'A']=&CtrlAltT;
void CtrlAltF()
{
I1 *st;
st=MSPrintF("%P",sys_update_screen_tss->rip);
RemoveLastSeg(st,",");
RawClassRep(st,sys_update_screen_tss->rbp,1,TRUE);
Free(st);
}
ctrl_alt_letter_routines['F'-'A']=&CtrlAltF;
void CtrlAltZ()
{
BoolU4 old_raw=Raw(ON);
coutln "0:",sysdbg0," 1:",sysdbg1;
coutln "2:",sysdbg2," 3:",sysdbg3;
Raw(old_raw);
}
ctrl_alt_letter_routines['Z'-'A']=&CtrlAltZ;
void CtrlAltE()
{
RawClassRep("TssStruct",sys_update_screen_tss,1,FALSE);
}
ctrl_alt_letter_routines['E'-'A']=&CtrlAltE;
void CtrlAltD()
{
Debugger;
}
ctrl_alt_letter_routines['D'-'A']=&CtrlAltD;
extern void MyScreenShot();
void PrintScreenTsk()
{
InitUserTask;
MyScreenShot;
}
void CtrlAltP()
{
Spawn(&PrintScreenTsk);
}
ctrl_alt_letter_routines['P'-'A']=&CtrlAltP;
#define COMM_BAUD 38400*3
void Tx(I1 *filename)
{
LTChnl *chnl;
CommClose(1);
chnl=CommOpen8N1(1,COMM_BAUD);
if (chnl) {
RmtTxFile(chnl,filename);
CommClose(1);
}
}
void Rx(I1 *filename)
{
LTChnl *chnl;
CommClose(1);
chnl=CommOpen8N1(1,COMM_BAUD);
if (chnl) {
RmtRxFile(chnl,filename);
CommClose(1);
}
}
void Host()
{
LTChnl *chnl;
CommClose(1);
chnl=CommOpen8N1(1,COMM_BAUD);
if (chnl)
TelnetHostOpen(chnl);
}
void CloseHost()
{
TelnetHostClose;
CommClose(1);
}
void Guest()
{
LTChnl *chnl;
CommClose(1);
chnl=CommOpen8N1(1,COMM_BAUD);
if (chnl) {
TelnetGuestOpen(chnl);
CommClose(1);
}
}
void RmtSync()
{
LTChnl *chnl;
CommClose(1);
chnl=CommOpen8N1(1,COMM_BAUD);
if (chnl) {
RmtMergeChk(chnl);
CommClose(1);
}
}
void RmtSyncDrive(I1 drive=0)
{
LTChnl *chnl;
Drive(drive);
CommClose(1);
chnl=CommOpen8N1(1,COMM_BAUD);
if (chnl) {
RmtMergeChk(chnl,"/LT/*","/LT/*",
"+r+t+a");
CommClose(1);
}
}
I1 *TADPickFile(I1 *msg,I1 *mask,I8 prefix_len=0)
{
I8 i=0;
LTDirEntry *tempm,*tempm1;
Ltf *l=LtfNew;
I1 *st;
tempm=FindFiles(mask);
tempm1=tempm;
if (msg)
LtfPutSExt(l,msg);
while (tempm1) {
if ((i++%5)==0)
LtfPutSExt(l,"\r\n");
st=NewStr(tempm1->name);
RemoveLastSeg(st,".");
LtfPrintF(l,"$$MU,\"%-8ts\",%d$$ ",st+prefix_len,tempm1);
Free(st);
tempm1=tempm1->next;
}
tempm1=PopUpMenu(l);
LtfDel(l);
if (tempm1<0)
st=NULL;
else
st=NewStr(tempm1->full_name);
DelLTDirList(tempm);
return st;
}
Binary file not shown.
Binary file not shown.
+16
View File
@@ -0,0 +1,16 @@
CrLf;
PrintF("Super : 3$$SY,-3$$2$$SY,0$$=9\r\n");
CrLf;
PrintF("Sub : H$$SY,3$$2$$SY,0$$O\r\n");
CrLf;
PrintF("Color : $$FG,RED$$Test$$FG$$\r\n");
CrLf;
PrintF("Blink : $$BK,1$$Test$$BK,0$$\r\n");
CrLf;
PrintF("Invert : $$IV,1$$Test$$IV,0$$\r\n");
CrLf;
PrintF("UnderLine: $$UL,1$$Test$$UL,0$$\r\n");
CrLf;
+51
View File
@@ -0,0 +1,51 @@
/*
$FG,2$This program allows you to measure the
timing of various instructions.
Don't be surprised by odd results
because the CPU does instructions in
parallel sometimes and a simple
instruction might take place in parallel
with the loop instruction and it will
report zero clock cycles.
$FG$*/
#define SAMPLE_SIZE 100000000
void TimeIns()
{
I8 i;
U8 start1,end1,start2,end2,overhead_time,test_time;
double reg d=5.0; //$FG,2$Use the $FG,4$reg$FG,2$ directive to designate register variables$FG$
Preempt(OFF);
//Measure Loop Overhead
start1=GetTimeStamp;
for (i=0;i<SAMPLE_SIZE;i++) {
}
end1=GetTimeStamp;
overhead_time=end1-start1;
start2=GetTimeStamp;
for (i=0;i<SAMPLE_SIZE;i++) {
$FG,4$#exe {OPassTraceMask(0b100000000);OTrace(ON);}
//$FG,2$Put your test instructions here.$FG,4$
d*=1.00001;
#exe {OTrace(OFF);}
$FG$ }
end2=GetTimeStamp;
test_time=end2-start2;
PrintF("\r\n\r\n\r\nCycles %10.5f\r\n",
(test_time-overhead_time)*1.0/SAMPLE_SIZE);
Preempt(ON);
}
TimeIns;
+33
View File
@@ -0,0 +1,33 @@
/*
This uses LtfPutSExt/LtfPrintF because updates
to within a tree while a tree is collapsed get
messed-up if "live"(like using ordinary PrintF/PutS.)
The insert point is confused by hiding of
data in collapsed trees. Therefore, the window main
Ltf is taken off-line by disabling preemption so there
are no screen updates until all data has been inserted.
There is a special Ltf function which is also
available to take an Ltf off-line. See $LK,"LtfSafeInsert","MN:LtfSafeInsert"$.
For this example, however, I wanted to use LtfPrintF
and disabled Preemption myself.
*/
#include "/LT/Demo/TreeDemoJoin"
void TreeDemo()
{
U8 f=0;
BoolU4 old_preempt;
Ltf *l=Fs->cur_ltf;
GetFFlags(&f,SysText("ST_FILE_UTIL_FLAGS"),"+r");
old_preempt=Preempt(OFF);
LtfPutSExt(l,"$$TR-C+AL,\"\"$$\r\n");
LtfPutSExt(l,"$$ID,+2$$");
TreeSub(l,FindFiles("/LT/*",f));
LtfPutSExt(l,"$$ID,-2$$");
LtfRecalc(l);
Preempt(old_preempt);
}
TreeDemo;
+25
View File
@@ -0,0 +1,25 @@
void TreeSub(Ltf *l,LTDirEntry *tempm)
{
LTDirEntry *tempm1;
while (tempm) {
tempm1=tempm->next;
if (tempm->attr & LT_ATTR_DIR) {
LtfPutSExt(l,"$$TR,\"\"$$");
LtfPrintF(l,"$$MA+A,\"%s\",\"Cd(\\\"%s\\\");Dir;\r\"$$\r\n",
tempm->name,tempm->full_name);
if (tempm->sub) {
LtfPutSExt(l,"$$ID,+2$$");
TreeSub(l,tempm->sub);
LtfPutSExt(l,"$$ID,-2$$");
}
} else {
LtfPrintF(l,"$$LK,\"%12s\",\"FI:%s\"$$\r\n",
tempm->name,tempm->full_name);
}
//Note there is also a routine
//to delete an entire LTDirEntry tree.
//See $LK,"DelLTDirList","MN:DelLTDirList"$().
DelLTDirEntry(tempm);
tempm=tempm1;
}
}
Binary file not shown.