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

+13
View File
@@ -0,0 +1,13 @@
//Change anything you want in this
//acct file or others.
#exe {OptOn(OPTf_WARN_PAREN);};
#exe {OptOn(OPTf_WARN_DUP_TYPES);};
#include "HOME/Adam3aLocalize"
#include "HOME/Adam3bPkgs"
#include "HOME/Adam3cSnd"
#include "HOME/Adam3dKeyPlugIns"
#include "HOME/Adam3eWrappers"
#include "HOME/Adam3fSys"
#exe {OptOff(OPTf_WARN_PAREN);};
#exe {OptOff(OPTf_WARN_DUP_TYPES);};
+9
View File
@@ -0,0 +1,9 @@
#include "/TempleOS/Accts/Adam3bPkgs"
#include "/TempleOS/Apps/TimeClock/Load"
#include "/TempleOS/Apps/MusicOrgan/Load"
Cd("HOME");;
#include "/TempleOS/Accts/TS/TSAdam"
#include "/TempleOS/Accts/TS/TSDistro"
#include "/TempleOS/Demo/WebLogExample/WebLogRep"
Cd("HOME");;
@@ -0,0 +1,266 @@
//Change anything you want in this
//acct file or others.
U0 FillInTime()
{
CDate spdt;
spdt=GetCurTimeCDate;
"$$IV,1$$----%D %T----$$IV,0$$\n",spdt,spdt;
}
U0 RandQuote(I64 num)
{ //$LK-A,"::/TempleOS/Apps/AfterEgypt/AENotes.TXT"$
I64 i,size,l=512;
U8 *bible_filename=Define("ST_BIBLE_FILE"),
*buf=FileRead(bible_filename,&size);
if (buf) {
i=num%(size-l);
buf[i+l]=0;
"" buf+i;
Free(buf);
}
}
U0 BadCodeJump(I64 num)
{ //$LK-A,"::/TempleOS/Apps/AfterEgypt/AENotes.TXT"$
CDirEntry *root=FilesFind("/TempleOS/*",FUF_JUST_FILES|FUF_RECURSE|FUF_FLATTEN_TREE|FUF_JUST_SRC_FILES),
*tempm=root;
I64 cnt=0;
CDoc *doc;
U8 *st;
while (tempm) {
doc=DocRead(tempm->full_name);
tempm->user_data=doc->root.y;
cnt+=doc->root.y;
DocDel(doc);
tempm=tempm->next;
}
num=num%cnt;
tempm=root;
while (tempm) {
num-=tempm->user_data;
if (num<0) {
st=MSPrintF("FL:%s,%d",tempm->full_name,-num);
break;
}
tempm=tempm->next;
}
CDirLstDel(root);
Ed(st);
Free(st);
}
Bool MyPutKey(I64 ch,I64 sc)
{ //ch=ASCII; sc=scancode
//See $LK,"Char","HI:Char"$ for definition of scan codes.
//See $LK,"Keyboard Handling","FI:::/TempleOS/Doc/KeyBoard.TXT"$
//You can customize keys. This routine
//is called before the main editor
//key handler $LK,"DocPutKey","MN:DocPutKey"$().
//You can intercept any key.
//Return TRUE if you completely
//handled the key.
I64 i,sc2=sc.u8[0];
if (SC_F1<=sc2<=SC_F10 &&
sc&SCF_ALT &&
!(sc & SCF_CTRL)) {
switch (sc2) {
case SC_F1:
if (sc&SCF_KEY_DESC) {
if (sc & SCF_SHIFT)
SetKeyDesc("Dollar/LTPURPLE");
else
SetKeyDesc("Dollar/PURPLE");
} else {
if (sc & SCF_SHIFT)
"$$FG,LTPURPLE$$";
else
"$$FG,PURPLE$$";
}
break;
case SC_F2:
if (sc&SCF_KEY_DESC) {
if (sc & SCF_SHIFT)
SetKeyDesc("Dollar/LTRED");
else
SetKeyDesc("Dollar/RED");
} else {
if (sc & SCF_SHIFT)
"$$FG,LTRED$$";
else
"$$FG,RED$$";
}
break;
case SC_F3:
if (sc&SCF_KEY_DESC) {
if (sc & SCF_SHIFT)
SetKeyDesc("Dollar/LTGREEN");
else
SetKeyDesc("Dollar/GREEN");
} else {
if (sc & SCF_SHIFT)
"$$FG,LTGREEN$$";
else
"$$FG,GREEN$$";
}
break;
case SC_F4:
if (sc&SCF_KEY_DESC) {
if (sc & SCF_SHIFT)
SetKeyDesc("Dollar/LTBLUE");
else
SetKeyDesc("Dollar/Default Color");
} else {
if (sc & SCF_SHIFT)
"$$FG,LTBLUE$$";
else
"$$FG$$";
}
break;
case SC_F5:
if (sc&SCF_KEY_DESC) {
if (sc & SCF_SHIFT)
SetKeyDesc("God Passage");
else
SetKeyDesc("God Word");
} else {
//$LK-A,"::/TempleOS/Apps/AfterEgypt/AENotes.TXT"$
if (sc & SCF_SHIFT)
RandQuote(KbdMouseEvtTime>>4);
else
"%s ",ws_sorted_words[KbdMouseEvtTime>>4%ws_num_words]->str;
}
break;
case SC_F6:
if (sc&SCF_KEY_DESC) {
if (sc & SCF_SHIFT)
SetKeyDesc("Cmd/Init WordStat Spirit");
else
SetKeyDesc("Cmd/Init WordStat TempleOS");
} else {
if (sc & SCF_SHIFT)
PopUp("WSInit(\"::/TempleOS/Apps/HolySpirit/Vocab.TXT*\");");
else
PopUp("WSInit(\"::/TempleOS/\" FILENAME_MASK_TXT \";~*Bible.TXT*\");");
}
break;
case SC_F7:
if (sc&SCF_KEY_DESC) {
if (sc & SCF_SHIFT)
SetKeyDesc("Dollar/Insert Hidden Widget");
else
SetKeyDesc("Misc/Insert Datetime");
} else {
if (sc & SCF_SHIFT)
DocInsSafe(DocCur,
"$$HS+C$$$$FG$$$$HE$$");
else
FillInTime();
}
break;
}
return TRUE;
} else {
if (!(sc & SCF_CTRL)) {
if (sc & SCF_ALT) {
switch (ch) {
case 'h':
if (sc&SCF_KEY_DESC)
SetKeyDesc("Win/Tile Horizontally");
else
WinTileHorz;
return TRUE;
case 'm':
if (sc&SCF_KEY_DESC)
SetKeyDesc("Win/Maximize");
else {
WinMax;
WinBorder;
}
return TRUE;
case 'v':
if (sc&SCF_KEY_DESC)
SetKeyDesc("Win/Tile Vertically");
else
WinTileVert;
return TRUE;
case 'V':
if (sc&SCF_KEY_DESC)
SetKeyDesc("Sys/Frame Grabber Toggle");
else
FrameGrabberToggle;
return TRUE;
case 'l':
if (sc&SCF_KEY_DESC)
SetKeyDesc("Edit/Put Link to Cur Pos on Clipboard");
else {
ClipBoardDel;
DocPrintF(sys_clipboard_doc,"$$LK-A,\"FL:%s,%d\"$$",
DocCur->filename.name,DocCur->cur_entry->y+1);
}
return TRUE;
case 'L':
if (sc&SCF_KEY_DESC)
SetKeyDesc("Edit/Place Anchor, Put Link to Clipboard");
else {
i=RandU32;
ClipBoardDel;
DocPrintF(sys_clipboard_doc,"$$LK,\"<TODO>\",\"FA:%s,ANC%d\"$$",
DocCur->filename.name,i);
"$$AN,\"<TODO>\",\"ANC%d\"$$",i;
}
return TRUE;
case 'w':
if (sc&SCF_KEY_DESC)
SetKeyDesc("Win/WordStat(ON);");
else
WordStat(ON);
return TRUE;
case 'W':
if (sc&SCF_KEY_DESC)
SetKeyDesc("Win/WordStat;");
else
WordStat;
return TRUE;
//Ins your own ALT-key plug-ins
case 'b':
if (sc&SCF_KEY_DESC)
SetKeyDesc("Cmd/Jump to Bad Code");
else //$LK-A,"::/TempleOS/Apps/AfterEgypt/AENotes.TXT"$
BadCodeJump(KbdMouseEvtTime>>4);
return TRUE;
case 'p':
if (sc&SCF_KEY_DESC)
SetKeyDesc("JukeBox(TAD)");
else
JukeBox("::/TempleOS/Accts/TS/TAD/MusicOrgan");
return TRUE;
case 'P':
if (sc&SCF_KEY_DESC)
SetKeyDesc("JukeBox(Examples)");
else
JukeBox("::/TempleOS/Apps/MusicOrgan/Examples");
return TRUE;
}
}
}
}
return FALSE;
}
Bool MyPutS(U8 *st)
{
nounusedwarn st;
return FALSE;
}
KeyDevAdd(&MyPutKey,&MyPutS,0x20000000,TRUE);
@@ -0,0 +1,9 @@
#include "/TempleOS/Accts/Adam3eWrappers"
#help_index "Utils;Cmd Line (Typically)"
public U0 M(U8 *src1,U8 *src2,U8 *fu_flags=NULL)
{
MergeChk(src1,src2,fu_flags);
}
#help_index ""
+60
View File
@@ -0,0 +1,60 @@
U0 UserStartUp()
{ //Run each time a user a spawned
UseTermDoc;
DocCurAttr(WHITE<<4+BLUE);
Type("::/TempleOS/Doc/Start.TXT");
LBts(&Fs->display_flags,DISPLAYf_SHOW);
WinZBufUpdate;
if (!IsSysDeterministic)
Preempt(ON);
Dir;
switch (ts_cid) {
case CID_TAD8:
"$$FG,GREEN$$TAD8$$FG$$: ";
break;
case CID_TAD8_VM:
"$$FG,RED$$TAD8_VM$$FG$$: ";
break;
case CID_DFT:
"$$FG,PURPLE$$DFT$$FG$$: ";
break;
}
CPURep;
}
U0 ServantStartUp()
{ //Run each time a servant task is spawned.
UseTermDoc;
LBts(&Fs->display_flags,DISPLAYf_SHOW);
WinZBufUpdate;
if (!IsSysDeterministic)
Preempt(ON);
}
CTask *user1,*user2;
U0 StartUpTasks()
{
user1=SpawnUser;
user2=SpawnUser;
WinToTop(user1);
WinTileVert;
if (!IsSysDeterministic)
PopUp("#include \"::/TempleOS/Adam/Start\";");
AdamLog("Boot Time:%7.3fs\n",tS);
XTalk(user1,"#include \"DoItOnce\";\n");
Silent(ON);
if (!IsSysDeterministic)
WSInit("/TempleOS/" FILENAME_MASK_TXT ";~*Bible.TXT*");
Silent(OFF);
AdamLog("WordStat Time:%7.3fs\n",tS);
if (ts_has_win_drv)
DrvEnable(TS_WIN_DRV_LET,OFF);
}
DelTree("::/Temp/ScreenShots");
MkDir("::/Temp/ScreenShots");
StartUpTasks;
"\nOS Compile Time:%D %T\n",sys_compile_time,sys_compile_time;
+12
View File
@@ -0,0 +1,12 @@
//This file is executed by the
//first terminal window upon start-up.
//See $LK,"DoItOnce","FF:HOME/Adam3fSys.CPP,DoItOnce"$.
//It goes in your HOME directory and
//you can customize it.
//Delete this to get rid of
//default start-up msg.
//Type("::/TempleOS/Doc/Customize.TXT");
Binary file not shown.
@@ -0,0 +1,20 @@
//Change anything you want in this
//acct file or others.
//This makes your keyboard fast
SetTypeMatic(0);
//Set Time Zone
local_time_offset=-7*60*60*CDATE_FREQ; //Pacific
snd_vol=0.1;
//$AN,"","mouse_move_scale"$adjust these to set mouse move scale
mxx_scale=0.5;
myy_scale=0.5;
mzz_scale=5.0; //wheel
//don't change these
mxx_prescale=mxx/mxx_scale;
myy_prescale=myy/myy_scale;
mzz_prescale=mzz/mzz_scale;
@@ -0,0 +1,488 @@
//ISO1 is ISO9660
//ISO2 is ISO13490
//ISO3 is ISO13346
//ISO13346 tag id types
#define ISO3T_PRI_VOL_DESC 1
#define ISO3T_ANCHOR_VOL_DESC_PTR 2
#define ISO3T_VOL_DESC_PTR 3
#define ISO3T_IMPLEMENTATION_VOL_DESC 4
#define ISO3T_PRT_DESC 5
#define ISO3T_LOG_VOL_DESC 6
#define ISO3T_UNALLOCATED_SPACE_DESC 7
#define ISO3T_TERMINATOR_DESC 8
#define ISO3T_LOG_VOL_INTEGRITY_DESC 9
#define ISO3T_FILE_SET_DESC 256
#define ISO3T_FILE_ID_DESC 257
#define ISO3T_ALLOC_EXTENT_DESC 258
#define ISO3T_INDIRECT_ENTRY 259
#define ISO3T_TERMINAL_ENTRY 260
#define ISO3T_FILE_ENTRY 261
#define ISO3T_EXT_ATTR_HEADER_DESC 262
#define ISO3T_UNALLOC_SPACE_ENTRY 263
#define ISO3T_SPACE_BITMAP_DESC 264
#define ISO3T_PRT_INTEGRITY_ENTRY 265
#define ISO3T_EXT_FILE_ENTRY 266
class CISO3Tag
{
U16 id;
U16 version;
U8 xsum;
U8 reserved;
U16 serial_num;
U16 desc_crc;
U16 desc_crc_len;
U32 loc;
};
class CISO3Date
{
U16 time_zone;
I16 year;
U8 mon;
U8 day;
U8 hour;
U8 min;
U8 sec;
U8 sec100;
U8 sec10000;
U8 sec1000000;
};
class CISO3DString32
{
U8 body[31];
U8 len;
};
class CISO3DString128
{
U8 body[127];
U8 len;
};
class CISO3CharSpec
{
U8 type;
U8 body[63];
};
class CISO3RegId
{
U8 flags;
U8 id[23];
U8 id_suffix[8];
};
class CISO3ExtentAD
{
U32 len;
U32 loc;
};
class CISO3LBAdd
{
U32 log_blk_num;
U16 prt_ref_num;
};
class CISO3LongAD
{
U32 len;
CISO3LBAdd loc;
U8 implementation_use[6];
};
class CISO3ICBTag
{
U32 prior_record_direct_entries;
U16 strategy_type;
U16 strategy_param;
U16 max_entries;
U8 reserved;
U8 file_type;
CISO3LBAdd parent_icb_loc;
U16 flags;
};
class CISO3PriDesc
{
CISO3Tag tag;
U32 vol_desc_seq_num;
U32 pri_vol_desc_num;
CISO3DString32 vol_id;
U16 vol_seq_num;
U16 max_vol_seq_num;
U16 interchg_level;
U16 max_interchg_level;
U32 char_set_lst;
U32 max_char_set_lst;
CISO3DString128 vol_set_id;
CISO3CharSpec desc_char_set;
CISO3CharSpec explanatory_char_set;
CISO3ExtentAD vol_abstract;
CISO3ExtentAD vol_copyright_notice;
CISO3RegId app_id;
CISO3Date recording_date_time;
CISO3RegId implementation_id[32];
U8 implementation_use[64];
U32 pred_vol_desc_seq_loc;
U16 flags;
U8 reserved[22];
};
class CISO3PrtMap
{
U8 type;
U8 len;
U0 mapping;
};
class CISO3PrtMap1
{
U8 type;
U8 len;
U16 vol_seq_num;
U16 prt_num;
};
class CISO3PrtMap2
{
U8 type;
U8 len;
U8 prt_id[62];
};
class CISO3LogVolDesc
{
CISO3Tag tag;
U32 vol_desc_seq_num;
CISO3CharSpec desc_char_set;
CISO3DString128 log_vol_id;
U32 blk_size;
CISO3RegId domain_id;
U8 log_vol_contents_use[16];
U32 map_table_len;
U32 num_prt_maps;
CISO3RegId implementation_id;
U8 implementation_use[128];
CISO3ExtentAD integrity_seq_extent;
U0 prt_maps;
};
class CISO3Prt
{
CISO3Tag tag;
U32 vol_desc_seq_num;
U16 flags;
U16 num;
CISO3RegId contents;
U8 contents_use[128];
U32 access_type;
U32 starting_loc;
U32 len;
CISO3RegId implementation_id;
U8 implementation_use[128];
U8 reserved[156];
};
class CISO3FileSetDesc
{
CISO3Tag tag;
CISO3Date recording_date_time;
U16 interchg_level;
U16 max_interchg_level;
U32 char_set_lst;
U32 max_char_set_lst;
U32 file_set_num;
U32 file_set_desc_num;
CISO3CharSpec log_vol_id_char_set;
CISO3DString128 log_vol_id;
CISO3CharSpec file_set_char_set;
CISO3DString32 file_set_id;
CISO3DString32 copyright_file_id;
CISO3DString32 abstract_file_id;
CISO3LongAD root_dir_icb;
CISO3RegId domain_id;
CISO3LongAD next_extent;
CISO3LongAD sys_stream_dir_icb;
U8 reserved[32];
};
class CISO3FileIdDesc
{
CISO3Tag tag;
U16 version;
U8 characteristics;
U8 len_of_file_id;
CISO3LongAD icb;
U16 len_of_implementation_use;
U0 implementation_use;
U0 file_id;
};
class CISO3File
{
CISO3Tag tag;
CISO3ICBTag icb_tag;
U32 uid;
U32 gid;
U32 permissions;
U16 file_link_cnt;
U8 record_fmt;
U8 record_display_attr;
U32 record_len;
I64 info_len;
I64 log_blks_recorded;
CISO3Date access_date_time;
CISO3Date modification_date_time;
CISO3Date attr_date_time;
U32 chk_pt;
CISO3LongAD ext_attr_icb;
CISO3RegId implementation_id;
I64 unique_id;
U32 ext_attr_len;
U32 alloc_desc_len;
U0 ext_attr;
U0 alloc_desc;
};
class CISO3FileExt
{
CISO3Tag tag;
CISO3ICBTag icb_tag;
U32 uid;
U32 gid;
U32 permissions;
U16 file_link_cnt;
U8 record_fmt;
U8 record_display_attr;
U32 record_len;
I64 info_len;
I64 object_size;
I64 log_blks_recorded;
CISO3Date access_date_time;
CISO3Date modification_date_time;
CISO3Date creation_date_time;
CISO3Date attr_date_time;
U32 chk_pt;
U32 reserved;
CISO3LongAD ext_attr_icb;
CISO3LongAD stream_dir_icb;
CISO3RegId implementation_id;
I64 unique_id;
U32 ext_attr_len;
U32 alloc_desc_len;
U0 ext_attr;
U0 alloc_desc;
};
import U0 ClassRep(U8 *class_name,U8 *d,I64 max_depth=2,Bool fun=FALSE,I64 offset=0);
Bool ISO3PrtInitPrt(CPrt *p,I64 blk)
{
CBlkDev *bdev=p->bdev;
I64 spc=bdev->blk_size>>BLK_SIZE_BITS,i=blk/spc;
CISO3FileSetDesc *iso=MAlloc(bdev->blk_size);
Bool unlock,result=FALSE;
try {
unlock=PrtLock(p);
while (TRUE) {
p->size=MaxI64(p->size,(i+1)*spc);
RBlks(p,iso,i*spc,spc);
"%X:%X\n",i,iso->tag.id;
switch (iso->tag.id) {
case ISO3T_FILE_SET_DESC:
ClassRep("CISO3FileSetDesc",iso,3);
// p->offset=blk;
// p->root_cluster=iso->root_dir_icb.loc.log_blk_num+p->offset/spc;
result=TRUE;
break;
case ISO3T_EXT_FILE_ENTRY:
ClassRep("CISO3FileExt",iso,3);
break;
case ISO3T_FILE_ENTRY:
ClassRep("CISO3File",iso,3);
break;
case ISO3T_FILE_ID_DESC:
ClassRep("CISO3FileIdDesc",iso,3);
break;
case ISO3T_ALLOC_EXTENT_DESC:
case ISO3T_INDIRECT_ENTRY:
case ISO3T_TERMINAL_ENTRY:
case ISO3T_EXT_ATTR_HEADER_DESC:
case ISO3T_UNALLOC_SPACE_ENTRY:
case ISO3T_SPACE_BITMAP_DESC:
case ISO3T_PRT_INTEGRITY_ENTRY:
break;
default
goto i3pip_done;
}
i++;
}
i3pip_done:
Free(iso);
if (unlock)
PrtUnlock(p);
} catch {
Free(iso);
if (unlock)
PrtUnlock(p);
}
return result;
}
Bool ISO3PrtInit(CPrt *p,I64 blk)
{
CBlkDev *bdev=p->bdev;
I64 spc=bdev->blk_size>>BLK_SIZE_BITS,i=blk/spc,offset=0;
CISO3Prt *iso=MAlloc(bdev->blk_size);
Bool unlock,result=FALSE;
try {
unlock=PrtLock(p);
while (TRUE) {
p->size=MaxI64(p->size,(i+1)*spc);
RBlks(p,iso,i*spc,spc);
"%X:%X\n",i,iso->tag.id;
switch (iso->tag.id) {
case ISO3T_PRT_DESC:
ClassRep("CISO3Prt",iso,3);
offset=iso->starting_loc*spc; //one partition for now
break;
case ISO3T_PRI_VOL_DESC:
ClassRep("CISO3PriDesc",iso,3);
break;
case ISO3T_LOG_VOL_DESC:
ClassRep("CISO3LogVolDesc",iso,3);
D(&iso(CISO3LogVolDesc *)->prt_maps);
break;
case ISO3T_ANCHOR_VOL_DESC_PTR:
case ISO3T_VOL_DESC_PTR:
case ISO3T_IMPLEMENTATION_VOL_DESC:
case ISO3T_UNALLOCATED_SPACE_DESC:
case ISO3T_LOG_VOL_INTEGRITY_DESC:
break;
case ISO3T_TERMINATOR_DESC:
goto i3pi_done;
default:
PutDefineErr("ST_UNSUPPORTED_FILE_SYSTEM");
throw(EXCEPT_PRT,10);
}
i++;
}
i3pi_done:
if (offset)
result=ISO3PrtInitPrt(p,offset);
Free(iso);
if (unlock)
PrtUnlock(p);
} catch {
Free(iso);
if (unlock)
PrtUnlock(p);
}
return result;
}
/****
U0 CDate2ISO3(CISO3Date *dst,CDate spdt)
{
CDateStruct ds;
CDate2CDateStruct(&ds,spdt);
MemSet(dst,0,sizeof(CISO3Date));
dst->year=ds.year;
dst->mon=ds.mon;
dst->day=ds.day_of_mon;
dst->hour=ds.hour;
dst->min=ds.min;
dst->sec=ds.sec;
dst->sec100=ds.sec100;
}
CDate ISO3Date2CDate(CISO3Date *dt)
{
CDateStruct ds;
MemSet(&ds,0,sizeof(CDateStruct));
ds.day_of_mon=dt->day;
ds.mon=dt->mon;
ds.year=dt->year;
ds.sec100=dt->sec100;
ds.sec=dt->sec;
ds.min=dt->min;
ds.hour=dt->hour;
return CDateStruct2CDate(&ds);
}
****/
Bool ISOPrtInit(CPrt *p,I64 blk)
{
CBlkDev *bdev=p->bdev;
I64 spc=bdev->blk_size>>BLK_SIZE_BITS,i=blk/spc;
CISO1PriDesc *iso=MAlloc(bdev->blk_size);
CISO1DirEntry *de;
Bool unlock,result=FALSE;
U8 buf[8];
try {
unlock=PrtLock(p);
p->type=PT_ISO9660; //default
p->spc=spc;
p->offset=p->data=p->root_cluster=p->size=0;
while (TRUE) {
p->size=MaxI64(p->size,(i+1)*spc);
RBlks(p,iso,i*spc,spc);
buf[0](U32)=iso->id[0](U32);
buf[4](U16)=iso->id[4](U8);
switch (LstEntryMatch(buf,"CD001\0CDW02\0BEA01\0BOOT2\0NSR02\0NSR03\0TEA01\0",LEF_EXACT)) {
case 0:
p->type=PT_ISO9660;
switch (iso->type) {
case ISO1T_SUPPLEMENTARY_DESC:
p->data=0;
de=&iso->root_dir_record;
p->root_cluster=de->loc.little;
p->size=iso->vol_space_size.little*bdev->blk_size>>BLK_SIZE_BITS;
result=TRUE;
goto ipi_done;
case ISO1T_TERMINATOR:
throw(EXCEPT_PRT,11);
}
break;
case 2...6:
p->type=PT_ISO13346;
break;
case 1: //PT_ISO13490 (Not supported)
default: //Its normal for ISO13346 to read NULL blk as terminator
switch (p->type) {
case PT_ISO13346:
i++; //Terminator is blk after last valid. Advance to next blk
if (ISO3PrtInit(p,i*spc)) {
result=TRUE;
goto ipi_done;
}
break;
}
PutDefineErr("ST_UNSUPPORTED_FILE_SYSTEM");
throw(EXCEPT_PRT,12);
}
i++;
}
ipi_done:
Free(iso);
if (unlock)
PrtUnlock(p);
} catch {
p->type=PT_ISO9660;
p->spc=spc;
p->offset=p->data=p->root_cluster=0;
Free(iso);
if (unlock)
PrtUnlock(p);
}
return result;
}
Binary file not shown.
@@ -0,0 +1,21 @@
$WW,1$I have a million metaphors. Linux is a semi; Windows is a car; and TempleOS is a motorcycle. Or, it's like a 1960's muscle car that wouldn't be street legal, now, with all the safety crap regulations complicating and gunking-up, but boy is it fun and beautiful under the hood. Maybe, it's a tree-house -- you don't need building codes to mod it and it has no networking. It's a kayak, not a Titanic -- just reset it. Why do you want a 1970's main frame operating system, anyway, that has ugly 32-bit crap all over its C language? 7-bit ASCII for source code? Please! Why not fix all the standard C library to pure 64-bit? How awful PrintF() with "%ld" instead of "%d" and crap for long constants! Yuck! You'll love $LK,"TempleOS C","FI:::/TempleOS/Doc/Differences.TXT"$.
Okay, here's a $LK,"Pop Quiz","FI:::/TempleOS/Demo/Lectures/64BitAsmQuiz.TXT"$ to get you psyched-up for TempleOS! Assembly language knowledge is not required, but anyone interested in TempleOS is probably at least curious about assembly language.
TempleOS has a good chance of running natively on $FG,4$x86_64$FG$ machines from about 2003-2010. After that, it will probably work just in VMware.
1) Download the free $FG,4$$TX+HTML,"TempleOSCD.ISO (24.0 MB)","http://www.templeos.org/TempleOSCD.ISO"$$FG$.
2) Download the free $FG,4$$TX+HTML,"VMware Player","https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/5_0"$$FG$ (The $FG,4$$TX+HTML,"VMware","https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/5_0"$$FG$ web page takes a whole minute to load completely. Be patient. When it finally shows, pick the first ".exe" to download.)
3) Create an "Other 64-Bit" virtual machine. Aim its CD-ROM to TempleOSCD.ISO
4) Play the virtual machine.
5) Log-in as "Accts/Install".
6) Optionally, purchase $FG,4$$TX+HTML,"VMware WorkStation","http://www.vmware.com"$$FG$ or download $FG,4$$TX+HTML,"WinImage","http://www.winimage.com/winimage.htm"$$FG$ if you wish to transfer files in and out.
If you want to install my personal version for $FG,4$$TX+HTML,"VMware","https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/5_0"$$FG$...
1b) Download the free $FG,4$$TX+HTML,"TempleOSTS.ISO (24.5 MB)","http://www.templeos.org/TempleOSTS.ISO"$$FG$.
3b) Create an "Other 64-Bit" virtual machine. Aim its CD-ROM to TempleOSTS.ISO
5b) Type >$FG,4$TSInstall;$FG$ or >$FG,4$TSUpgrade;$FG$ at the command-line.
7b) See $FG,4$MakeBackUp$FG$ to reproduce the ISO's in $FG,4$E:/Wb$FG$. It makes this website, too.
* "WinImage" is a trademark of Gilles Vollant.
@@ -0,0 +1,217 @@
/*
You can play with this if you are
interested in USB. I'm not planning
on doing USB unless the legacy PS2
keyboard/mouse mode disappears.
There EHCI UHCI in various ICH chips and
others and God knows how many custom packet
formats for different keyboards and mice. Okay,
I suppose if BIOS can make a universal
packet, it is done just one way for
different mice. PS2 is more compatible.
*/
#help_index "USB"
extern I64 sys_num_usb;
extern CUSB sys_usb_devs[MAX_USB];
extern CUSBTD *USBAllocTD();
extern U0 USBFreeTD(CUSBTD *temptd);
extern U0 USBEndAll();
extern U0 USBInitAll();
extern U32 *USBAllocFrameLst(I64 usb_num,I64 size);
U8 *StatCB(CDoc *,CDocEntry *doc_e,CTask *mem_task)
{ //This routine shows the stat of the USB ports
U8 *st=MAlloc(128,mem_task);
U16 w1,w2,w3,w4;
U32 d1;
CUSB *u=doc_e->user_data;
I64 d=u->ports;
w3=InU16(d+USBP_STS);
w1=InU16(d+USBP_PORTSC0); w2=InU16(d+USBP_PORTSC1);
w4=InU16(d+USBP_FRNUM);
d1=InU32(d+USBP_FRBASEADD);
SPrintF(st,"%X:Stat:%04X P0:%04X P1:%04X FRAME:%04X",d1,w3,w1,w2,w4);
return st;
}
U0 PutStat()
{
I64 i;
Bool old_preempt=Preempt(OFF);
CDocEntry *doc_e;
CUSB *u;
WinMax;
"$$FG,GREEN$$Dev Stat Bits\n$$FG$$"
" 0:IRQ\n"
" 1:IRQ err\n"
" 2:Resume\n"
" 3:Host Sys Err\n"
" 4:Host Process Err\n"
" 5:Halted\n"
"$$FG,GREEN$$Port Stat Bits\n$$FG$$"
" 0:Connection Stat\n"
" 1:Connection Stat Change\n"
" 2:Port Enabled\n"
" 3:Port Enabled Change\n"
"4-5:Line Stat\n"
" 6:Resume Detect\n"
" 8:Low Speed\n"
" 9:Port Rst\n"
" 10:Overcurrent Active\n"
" 11:Overcurrent Indicator\n"
" 12:Suspend\n\n";
for (i=0;i<sys_num_usb;i++) {
u=&sys_usb_devs[i];
"$$FG,LTRED$$Dev%d:%X:",i,u->ports;
doc_e=DocPutS(DocCur,"$$TX+TC,\" \"$$");
doc_e->user_data=&sys_usb_devs[i];
doc_e->tag_cb=&StatCB;
"$$FG$$\n";
}
Preempt(old_preempt);
NewLine;
}
extern U0 PutQH(U32 h);
U32 *P(U32 d)
{
return d&~3;
}
U0 PutTD(U32 t)
{
"TD:$$FG,GREEN$$%08X$$FG$$\n",t;
"%08X\n",*P(t);
DocDm(t+4,8);
if (*P(t+12))
DocDm(*P(t+12),16);
// DocDm(*P(t+12),*P(t+4)>>21&0x7FF);
if (!(*P(t)&1)) {
if (*P(t)&2)
PutQH(*P(t));
else
PutTD(*P(t));
}
}
U0 PutQH(U32 h)
{
"QH:$$FG,RED$$%08X$$FG$$\n",h;
"%08X\n",*P(h);
"%08X\n",*P(h+4);
if (!(*P(h)&1)) {
if (*P(h)&2)
PutQH(*P(h));
else
PutTD(*P(h));
}
if (!(*P(h+4)&1)) {
if (*P(h+4)&2)
PutQH(*P(h+4));
else
PutTD(*P(h+4));
}
}
U0 PutFrame(U32 f)
{
PutQH(f);
}
U0 PutFrames()
{
I64 i,d,f,w1,w2;
CUSB *u;
for (i=0;i<sys_num_usb;i++) {
u=&sys_usb_devs[i];
d=u->ports;
w1=InU16(d+USBP_PORTSC0); w2=InU16(d+USBP_PORTSC1);
if (w1&1 || w2&1) {
f=InU32(d+USBP_FRBASEADD);
PutFrame(f);
}
}
}
U0 Main()
{
USBInitAll;
PutStat;
PutFrames;
"$$FG,RED$$The BIOS sets-up the USB in PS/2 legacy mode.$$FG$$\n";
}
Main;
/* Not Finished
#define PORT 5
#define DEV_ADD_INIT 1
#define DEV_ADD 1
#define END_PT0 0
#define END_PT1 1
#define END_PT2 2
#define MAX_LEN 8
#define TERMINATE 1
U0 SetUpTD()
{
CUSB *u=&sys_usb_devs[PORT];
I64 i,d=u->ports;
U32 *frm=CAllocAligned(0x1000,0x1000,Fs->code_heap),
*tds=CAllocAligned(256,16,Fs->code_heap),
*buf=CAlloc(128,Fs->code_heap);
DocD(buf,128);
"<0>\n"; Sleep(100);
OutU16(d+USBP_CMD,2); //Reset
"<1>\n"; Sleep(100);
OutU16(d+USBP_CMD,0);
"<2>\n"; Sleep(100);
OutU16(d+USBP_PORTSC0,4); //Enable
OutU16(d+USBP_PORTSC1,4);
"<3>\n"; Sleep(100);
tds[0]=&tds[4](U8 *);
tds[1]=0;
tds[2]=PID_SETUP+DEV_ADD_INIT<<8+END_PT0<<15+MAX_LEN<<21;
tds[3]=buf;
buf[0]=0+RQ_SET_ADDR<<8+DEV_ADD<<16;
buf[1]=0+0<<16;
tds[4]=TERMINATE;
tds[5]=0;
tds[6]=PID_SETUP+DEV_ADD_INIT<<8+END_PT0<<15+MAX_LEN<<21;
tds[7]=buf(U8 *)+8;
buf[2]=0+RQ_SET_ADDR<<8+DEV_ADD<<16;
buf[3]=0+0<<16;
frm[0]=&tds[0](U8 *);
for (i=1;i<0x1000/4;i++)
frm[i]=TERMINATE;
OutU16(d+USBP_FRNUM,frm);
OutU32(d+USBP_FRBASEADD,frm);
"<4>\n"; Sleep(200);
OutU16(d+USBP_CMD,1);
"<5>\n"; Sleep(1000);
OutU16(d+USBP_CMD,0);
"<6>\n"; Sleep(200);
}
SetUpTD;
*/
@@ -0,0 +1,114 @@
#define USBP_CMD 0x00
#define USBP_STS 0x02
#define USBP_INTR 0x04
#define USBP_FRNUM 0x06
#define USBP_FRBASEADD 0x08
#define USBP_SOFMOD 0x0C
#define USBP_PORTSC0 0x10
#define USBP_PORTSC1 0x12
#define MAX_USB 16
class CUSBTD //Not implemented
{
U32 td[4];
};
class CUSB //Not implemented
{
U8 num, //USB dev num
bus,dev,fun;
U16 ports,pad;
U32 *frame_lst;
};
//USB Pkt ID's
#define PID_OUT 0xE1
#define PID_IN 0x69
#define PID_SOF 0xA5
#define PID_SETUP 0x2D
#define PID_DATA0 0xC3
#define PID_DATA1 0x4B
#define PID_DATA2 0x87
#define PID_MDATA 0x0F
#define PID_ACK 0xD2
#define PID_NAK 0x5A
#define PID_STALL 0x1E
#define PID_NYET 0x96
#define PID_PRE 0x3C
#define PID_ERR 0x3C
#define PID_SPLIT 0x78
#define PID_PING 0xB4
//USB Std Rqsts
#define RQ_GET_STAT 0x0
#define RQ_CLR_FEAT 0x1
#define RQ_SET_FEAT 0x3
#define RQ_SET_ADDR 0x5
#define RQ_SET_DESC 0x7
#define RQ_GET_CFG 0x8
#define RQ_SET_CFG 0x9
#define RQ_GET_INTERFACE 0xA
#define RQ_SET_INTERFACE 0xB
#define RQ_SYNC_FRAME 0xC
I64 sys_num_usb=0;
CUSB sys_usb_devs[MAX_USB];
MemSet(sys_usb_devs,0,MAX_USB*sizeof(CUSB));
U0 USBInitOne(I64 b,I64 d,I64 f)
{
CUSB *u;
if (sys_num_usb<MAX_USB &&
PCIReadU16(b,d,f,0)==0x8086) {
u=&sys_usb_devs[sys_num_usb++];
u->num=sys_num_usb;
u->bus=b;
u->dev=d;
u->fun=f;
u->ports=PCIReadU32(b,d,f,0x20)&~0x1F;
}
}
U0 USBEndAll()
{
sys_num_usb=0;
}
U0 USBInitAll() //This is only valid for my ICH10 dev
{
if (sys_num_usb)
USBEndAll;
USBInitOne(0,29,0);
USBInitOne(0,29,1);
USBInitOne(0,29,2);
USBInitOne(0,29,3);
USBInitOne(0,26,0);
USBInitOne(0,26,1);
USBInitOne(0,26,2);
}
CUSBTD *USBAllocTD()
{
return MAllocAligned(sizeof(CUSBTD),0x10,sys_uncached_heap);
}
U0 USBFreeTD(CUSBTD *temptd)
{
Free(temptd);
}
U32 *USBAllocFrameLst(I64 usb_num,I64 size)
{ //aligned to 0x1000
CUSB *u;
if (0<=usb_num<sys_num_usb) {
u=&sys_usb_devs[usb_num];
Free(u->frame_lst);
u->frame_lst=MAllocAligned(size*sizeof(U32),0x1000,sys_uncached_heap);
OutU16(u->ports+USBP_CMD,0); //Stop
OutU16(u->ports+USBP_FRNUM,0);
OutU32(u->ports+USBP_FRBASEADD,u->frame_lst);
return u->frame_lst;
}
return NULL;
}
@@ -0,0 +1,54 @@
/*$HL,0$
$FG,5$$TX+CX,"Roll Your Own Distro"$$FG$
It's unlikely you will get it running on bare hardware, so you'll probably
run it in a virtual machine such as VMware. Download the free 64-bit
$FG,4$$TX+HTML,"VMware Player","https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/5_0"$$FG$ for Linux or Windows and point the CDROM at the $FG,4$$TX+HTML,"TempleOSCD.ISO","http://www.templeos.org/TempleOSCD.ISO"$$FG$.
(The $FG,4$$TX+HTML,"VMware","https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/5_0"$$FG$ web page takes a whole minute to load. They hide the free version.)
Purchase $FG,4$$TX+HTML,"VMware WorkStation","http://www.vmware.com"$$FG$ or download $FG,4$$TX+HTML,"WinImage","http://www.winimage.com/winimage.htm"$$FG$ if you wish to transfer files
in and out. The VMWare Workstation will stretch to full-screen and make drives
accessible from Windows.
$HL,1$*/
#define STD_DISTRO_CDROM_CFG "b10x20000\nt3 \n\n\n\n\n"
U0 MakeMyISO(U8 *out_iso_filename)
{//Does everything with current drive.
if (!IsDrvWritable) {
"Drive must be writable. Install on Hard drive, first.\n";
return;
}
DelTree("/Distro");
Auto(STD_DISTRO_CDROM_CFG);
MakeOSInstallPrtBootLoader(,'T');
CopyTree("/0000Boot","/Distro/0000Boot");
CopyTree("/TempleOS","/Distro/TempleOS");
//To save space, optionally delete dictionary.
Del("/Distro/TempleOS/Adam/WordStat/WSDefs.DAT");
Del("/Distro/TempleOS/Misc/Bible.TXT.Z");
Del("/Distro/TempleOS/Misc/PCIDevices.TXT.Z");
MkDir("/Distro/Temp");
MkDir("/Distro/Temp/ScreenShots");
CDFileCreate(out_iso_filename,"/Distro/*","",BOOTCD_BIN_Z);
//CDImageWrite('T',out_iso_filename,MT_CD); //Uncomment to burn a CD-ROM or (MT_DVD)
//DelTree("/Distro");
}
MakeMyISO("/MyDistro.ISO");
// Study my account examples $LK,"Cfg Strs","FL:::/TempleOS/Demo/AcctExample/TSAdam.CPP,1"$ $LK,"Update Funs","FL:::/TempleOS/Demo/AcctExample/TSDistro.CPP,1"$.
/*
* "Linux" is probably a trademark owned by Linus Torvalds.
* "VMware Player" and "VMware WorkStation" are trademarks of VMware, Inc.
* "Windows" is a trademark of MicroSoft Corp.
* "WinImage" is a trademark of Gilles Vollant.
*/
@@ -0,0 +1,193 @@
* Cursor is not solid $LK,"Dbg","MN:Dbg"$ when entered in Adam2.
* ata base- base1 temp blkdev
* clean-up addDev pmt
* indent
* TestSuite Strut
* Might want to convert some Preempt() to Cli
* Bug: Back-up-script cause jumps back and forth in ToHtml.
* Bug? Hung after pressing CmpMain in personal menu. Haven't seen in a while.
* Crashes after back-up-script. Went away maybe after spurious IRQ fix.
* Music organ hangs when cursoring around. Haven't seen in while.
* $LK,"DocUpdateTaskDocs","MN:DocUpdateTaskDocs"$() used to skips locked docs. $LK,"WinMgrSync","MN:WinMgrSync"$() needs to check?
* Why was wordstat so slow on "OldMasterBootWrite" for example.
* $LK,"Plain","MN:Plain"$() might be better not saving $LK,"CH_CURSOR","MN:CH_CURSOR"$.
* TRANSPARENT might not work with line ROPF_DITHER
* It would be nice if $LK,"U","MN:U"$() NOP were better.
* Autoindent is very bad.
* Make native file system expanded size set in Copy.
* unhandled exception on MP message gets overwritten by WinMgr
* Cmd to enable/disable compiler warnings
* make aware of ctrl-r side bar
* fix documentation problem -- remembering 0 terminator in str or not for $$DA
* GetS, crazy putkey code
* editor page formatting is FUBAR
* $LK,"gr_screen_image","MN:gr_screen_image"$
>Might want to do ZOOM in U8 graphics and convert screen capture to U8
>Might want to reverse bit order
* wenceslas crashes in testsuite, sometimes. went away?
* CGrVectMap sucks -- Pilgrim
* return vals for grrect, grblot, grputchar?
* collisions for grrect, grblot, grputchar?
* 32-bit devices should be in free spot address space of E820.
* RAM drive too small for TempleOSCD.ISO
$WW,1$
* Race condition in Navy.CPP.Z torpedo
* {Lock|Rep}{Seg|2E=NotBr|3E=Br}{OP}{ADD}{REX}
* Virtual Box MP reboot
* Std local var names
* EIE_ABS_ADDR 64
//After Egypt possible future ideas
//$LK,"Numbers,13:33","BF:Numbers,13:33"$ scouts
//$LK,"Numbers,21:8","BF:Numbers,21:8"$ snakes
GrEdit: Move sidebar selected elems.
- Be careful of multipt elems.
GrEdit: Strip origin shift cmds.
GrEditBitMap, grabscroll?
GrEditBitMap, cut/paste boxes.
extern of fun with dft arg of str?
* We kinda need a routine to return how much free memory, so that applications can plan a big alloc.
* FileMgr bad with lots of files.
* This $LK,"Fs->catch_except=TRUE","FF:::/TempleOS/Kernel/TaskCmd.CPP,Fs->catch_except=TRUE"$ causes problems because it catches divide and out-of-mem. Not sure what to do, yet.
* $LK,"MPStart","MN:MPStart"$() free old task memory. (Prolly never gonna do anything about this.)
* $LK,"sys_var_init_flag","MN:sys_var_init_flag"$ local vars.
* sprite shift pts, ctrl pt for ellipse/polygon w,h is off when rotated.
* Window mgr needs to do DOC operations on posted messages from mouse. Works for $LK,"SetIP","MN:SetIP"$(), though.
* Add local vars to sym table in $LK,"Dbg","MN:Dbg"$()? (maybe)
This shit:
$HC,"<object width=\"750\" height=\"520\"><param name=\"movie\" value=\"http://www.youtube.com/v/WAr-xYtBFbY?hl=en&fs=1\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/WAr-xYtBFbY?hl=en&fs=1\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"750\" height=\"520\"></embed></object>"$
* $LK,"Bible sized nodes","FF:::/TempleOS/Adam/Doc/DocRecalc.CPP,->tag+i"$
* Mouseinstall throws exceptions, doesn't work, investigate Mouse $LK,"0x9FC30","FF:::/TempleOS/Kernel/KbdMouse/Mouse.CPP,9FC"$
* get kbd lights working.
* figure-out hyperthread vs nonhyperthread CPU's
* Might have issue with compiler exceptions and restoring lex.hash tables.
* Generates two compiler error messages for expressions in statements.
* release semaphores or break lock sema,usb_td
* Fix Mom's secondary CD-ROM, dad's primary
* pmtstr in install didn't like focus change
*$FG,2$U0 Main()
{
U0 (*fp_old_draw_input_ptr)(CDC *dc,I64 x,I64 y)=fp_draw_input_ptr;
}$FG$
* Syncronize VGA memory update with the hardware refresh cycle.
* Demo $LK,"ToHtml","MN:ToHtml"$().
* Del short name in FAT32--currently I do not check to see if I have generated a unique short name and one can delete multiple files accidentally. Generating unique short names is a pain in the ass because you have to scan the whole directory. I think I just truncate the name instead of "Program~1" or whatever. S081130-0001.BMP crashed windows--two identical short names.
* OVERSTRIKE at cmd line with menu macro.
* $FG,2$lock{}$FG$ warning on invalid modes.
* Local array vars-->reg.
* $LK,"DCF_SYMMETRY","MN:DCF_SYMMETRY"$, before transformation? (Currently it's after)
* all graphics clipping -- screen y+top<0 for top<0
* Maybe convert graphics to float
* compiler F32
* preempt(OFF) during graphic clipping?
* compiler optimization heap_glbls with added offset
* AOT-compile extern glblvar references.
* extern glbl var in AOT module on data heap.
* Might make FAT32 read in contiguous chunks.
* make Limit(),Min(),Max() asm routines.
* Might make CSprite flood fill operate on a separate bitmap and blotted at the end.
* autofile popup of popup
* <CTRL-R> delete subsprite in menu near others
* consider changing domenu so a real <ESC> on menu item doesn't select (<SPACE BAR> sends <ESC> followed by <SPACE BAR> or something)
* puts3 with depth buf? might not do this
* make task queins and querem safe for multicore cycling through tasks (fwd).
* make better heapwalk, do something with _CFG_HEAP_DBG.
* log to file--would be inefficient--load-in whole file, modify and write out. Useful, but not very efficient (TempleOS file system has no grow-file ability. Created when FAT patent was an issue and wanted absly nothing people could sue me for.)
* APIC2
* import intel datasheets, somehow?
* Might make DskView show drive colors.
* Might do utility to set drive colors, making a tree entry in Adam 3 using registry-like routines... or registry I guess.
* New Editor widgets
* Make use of flag potential in SysFilesFind and possibly CFileAccess
* implement fixed pos files
* new C+ language features
* better debugging
* Change hardcoded stuff to Define
* Too much preemption turned off?
* Look for mem leaks.
* Move stuff out of Kernel module.
* $LK,"ROP_XOR","MN:ROP_XOR"$ with pen_width>1 is broken.
* use width and height in line clipping for pen_width>1 or blot.
* SIMD transformation
* test removable media id (critical for resident files)
* add field overflow U8 "t='*'"
* Implement fmt codes into GetF
* GetF date codes and maybe $FG,2$h$FG$ fmts for nums
* Date Input
* Default date fmt
* 16 bit Unassembly is bad--very low priority
* more signed int disassembly
* support r4u8 by adding 0x40 byte
* static var off of data heap.
* Might want to use U32*U32 multiplication.
* could add "const" to not set LF_NOT_CONSTANT flag for trig, etc.
* do r,rm ICCmp like ICBrCmp
* could make glblvar imports use TY_RIP_DISP32.
* 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?
* NOP1 might need to have diff ic_data's
* in divequal, it assumes about ebx
* error/warning line nums
* ASM branch out warning of range off by 1 line--use lx->last_line_num
* Switch statement with sparse cases (low priority)
* maybe inline functions?
* Use of more floating-point stk?
* More aggressive in this routine $LK,"CmpF2PushPop","MN:CmpF2PushPop"$() with types besides MOV and F64.
* !dbl ~dbl
* &=, |= can overflow with Bts Btr on small data types
* num lock comes on with break key
* sort options for findfiles
* recalc_start could be more accurate before recalculating?
* Maybe, get rid of $LK,"0x20000","FF:::/TempleOS/Compiler/CmpMain.CPP,0x20000"$ in compiler.
@@ -0,0 +1,13 @@
$TR,"Adam"$
$ID,2$$TR,"TempleOS"$
$ID,2$$TR,"SysMsgFlags"$
$ID,2$sys_msg_flags[0]=0x205;
$ID,-2$$TR,"SysRegVer"$
$ID,2$registry_version=1.000;
$ID,-2$$ID,-2$$ID,-2$$TR,"DemoCompany"$
$ID,2$$TR,"Game1"$
$ID,2$F64 best_score=1.23;
$TR,"SimpleVal"$
$ID,2$1234;
$ID,-2$$ID,-2$$ID,-2$$TR,"TempleOS"$
$ID,2$$ID,-2$
+436
View File
@@ -0,0 +1,436 @@
Bool IsDrvVMware(U8 drv_let)
{
Bool result=FALSE;
U8 *m=NULL;
try
if ((m=DrvModelNum(drv_let)) &&
!MemCmp(m,"VMware",6))
result=TRUE;
catch
Fs->catch_except=TRUE;
Free(m);
return result;
}
I64 DrvMaxBlk(U8 drv_let)
{
I64 result=0;
CBlkDev *bdev;
try {
if (bdev=Drv2BlkDev(drv_let))
result=bdev->max_blk;
} catch
Fs->catch_except=TRUE;
return result;
}
I64 IsDrvATAPI(U8 drv_let)
{
Bool result=FALSE;
CBlkDev *bdev;
try if ((bdev=Drv2BlkDev(drv_let)) &&
bdev->type==BDT_ATAPI)
result=TRUE;
catch
Fs->catch_except=TRUE;
return result;
}
Bool ChkDrvModelSerial(U8 drv_let,U8 *model,U8 *serial)
{
Bool result;
U8 *m=NULL,*s=NULL;
try {
m=DrvModelNum(drv_let);
s=DrvSerialNum(drv_let);
} catch {
Free(m); Free(s);
m=NULL; s=NULL;
Fs->catch_except=TRUE;
}
if (m && s && !StrCmp(m,model) && !StrCmp(s,serial))
result=TRUE;
else
result=FALSE;
Free(m); Free(s);
return result;
}
#define CID_DFT 0
#define CID_TAD8 1 //This was my old machine but it died. Booted natively
#define CID_TAD8_VM 2 //It could run booted with physical drive in VMware
//My current machine is TAD9 but it only runs in VMware, so it's CID_DFT
I64 ts_cid=CID_DFT;
U0 TSIDComputer()
{
/* My TAD8 computer died. It had two hard drives. You could
boot it directly or from VMware with a physical drive.
CMemE820 *m20=SYS_MEM_E820;
if (IsDrvVMware('D') && DrvMaxBlk('D')==0x575466EF)
ts_cid=CID_TAD8_VM; //VMware boot of TAD8
else if (ChkDrvModelSerial('D',"Hitachi HDS721075KLA330","GTF202P8H509AF") &&
ChkDrvModelSerial('I',"ST3320620AS","6QF24J0A"))
ts_cid=CID_TAD8; //Regular boot of TAD8
else if (dft_drv=='T' && IsDrvATAPI('T') && m20[11].base==0x100000000 &&
m20[11].base(I64)+m20[11].len-1==0x33FFFFFFF)
ts_cid=CID_TAD8; //CDROM boot of TAD8
*/
} TSIDComputer;
U0 TSInit()
{
//TS_IMG_DRV is for the holding area for burning CDROMs
CATARep *root=NULL,*ata_drv=NULL,*atapi_drv=NULL;
CBlkDev *bdev;
switch (ts_cid) {
/* This machine died, but you can use it as an example.
case CID_TAD8:
case CID_TAD8_VM:
DefinePrintF("CFG_ACCT","\"\nTS/TAD\n\"");
DefinePrintF("CFG_HARD_DRVS","\"h2s0xbc00\n0xb880\n1d2s0xbc00\n0xb880\n0\"");
DefinePrintF("CFG_RAM_DRVS","\"b1Scale2Mem(2048,0x40000)\nz1Scale2Mem(2048,0x40000)\n\"");
DefinePrintF("CFG_CDROM_DRVS","\"t3s0xb800\n0\"");
DefinePrintF("CFG_DSK_CACHE","\"Scale2Mem(0x80000,0x8000000)\n\"");
if (ts_cid==CID_TAD8) {
DefinePrintF("TS_HDS","\"DEI\"");
DefinePrintF("TS_MASTER_BOOT_DRVS","\"I\"");
} else { //CID_TAD8_VM
DefinePrintF("TS_HDS","\"DE\"");
DefinePrintF("TS_MASTER_BOOT_DRVS","\"\"");
}
DefinePrintF("TS_MAIN_DRV","\"D\"");
DefinePrintF("TS_BAK_DRV","\"E\"");
DefinePrintF("TS_RAM_DRV","\"B\"");
DefinePrintF("TS_WIN_DRV","\"H\"");
DefinePrintF("TS_IMG_DRV","\"Z\"");
DefinePrintF("TS_CDROM_DRV","\"T\"");
break;
*/
case CID_DFT:
DefinePrintF("CFG_ACCT","\"\nTS/TAD\n\"");
DefinePrintF("CFG_RAM_DRVS","\"b1Scale2Mem(2048,0x40000)\nz1Scale2Mem(2048,0x40000)\n\"");
if (sys_auto_mount_ide_cnt) {
//If AutoMount was successful, No need to manually mount in next compile
DefinePrintF("CFG_HARD_DRVS","\"\"");
DefinePrintF("CFG_CDROM_DRVS","\"\"");
} else {
//These two are a crazy guess. ATA:IDE Primary ATAPI:IDE Secondary
DefinePrintF("CFG_HARD_DRVS","\"d2s0x1F0\n0x3F4\n0\"");
DefinePrintF("CFG_CDROM_DRVS","\"t3s0x170\n0\"");
bdev=Drv2BlkDev(dft_drv);
if (bdev->type==BDT_ATAPI) {
ATARep(FALSE,,&root);
ATAIDDrvs(root,dft_drv,&ata_drv,&atapi_drv);
if (ata_drv)
DefinePrintF("CFG_HARD_DRVS","\"d2p%d\n\"",ata_drv->num);
if (atapi_drv)
DefinePrintF("CFG_CDROM_DRVS","\"t3p%d\n\"",atapi_drv->num);
} else {
try {
bdev=Drv2BlkDev('D');
DefinePrintF("CFG_HARD_DRVS","\"d2s0x%X\n0x%X\n%d\"",
bdev->base0,bdev->base1,bdev->unit);
} catch
Fs->catch_except=TRUE;
try {
bdev=Drv2BlkDev('T');
DefinePrintF("CFG_CDROM_DRVS","\"t3s0x%X\n%d\"",bdev->base0,bdev->unit);
} catch
Fs->catch_except=TRUE;
}
}
DefinePrintF("CFG_DSK_CACHE","\"Scale2Mem(0x80000,0x8000000)\n\"");
DefinePrintF("TS_HDS","\"DE\"");
DefinePrintF("TS_MASTER_BOOT_DRVS","\"D\"");
DefinePrintF("TS_MAIN_DRV","\"D\"");
DefinePrintF("TS_BAK_DRV","\"E\"");
DefinePrintF("TS_RAM_DRV","\"B\"");
DefinePrintF("TS_WIN_DRV","\"\"");
DefinePrintF("TS_IMG_DRV","\"Z\"");
DefinePrintF("TS_CDROM_DRV","\"T\"");
}
} TSInit;
Bool ts_has_main_drv =ToBool(StrLen(TS_MAIN_DRV)),
ts_has_bak_drv =ToBool(StrLen(TS_BAK_DRV)),
ts_has_ram_drv =ToBool(StrLen(TS_BAK_DRV)),
ts_has_win_drv =ToBool(StrLen(TS_WIN_DRV)),
ts_has_img_drv =ToBool(StrLen(TS_IMG_DRV)),
ts_has_cdrom_drv=ToBool(StrLen(TS_CDROM_DRV));
U0 TSInit2()
{
DefinePrintF("TS_MAIN_DRV_LET","'%s'",TS_MAIN_DRV);
DefinePrintF("TS_BAK_DRV_LET","'%s'",TS_BAK_DRV);
DefinePrintF("TS_RAM_DRV_LET","'%s'",TS_RAM_DRV);
DefinePrintF("TS_WIN_DRV_LET","'%s'",TS_WIN_DRV);
DefinePrintF("TS_IMG_DRV_LET","'%s'",TS_IMG_DRV);
DefinePrintF("TS_CDROM_DRV_LET","'%s'",TS_CDROM_DRV);
} TSInit2;
if (ts_has_main_drv)
SetDrvTextAttr(TS_MAIN_DRV_LET, WHITE <<4|BLUE);
if (ts_has_bak_drv)
SetDrvTextAttr(TS_BAK_DRV_LET, WHITE <<4|RED);
if (ts_has_ram_drv)
SetDrvTextAttr(TS_RAM_DRV_LET, BLUE <<4|YELLOW);
if (ts_has_win_drv)
SetDrvTextAttr(TS_WIN_DRV_LET, LTRED <<4|BLACK);
if (ts_has_img_drv)
SetDrvTextAttr(TS_IMG_DRV_LET, BLUE <<4|LTRED);
if (ts_has_cdrom_drv)
SetDrvTextAttr(TS_CDROM_DRV_LET,LTGRAY<<4|BLUE);
#define TS_ISO_NAME TS_RAM_DRV ":/TempleOSCD.ISO"
#define CFG_OPTS "ProtectLow\nAutoMountIDE\nDT\n"
#define CFG_DBG_OPTS "ProtectLow\nAutoMountIDE\nDTDet\nHeapInit\n130\nMemInit\n131\nVarInit\n132\n\n"
#define CFG_DBGZ_OPTS "ProtectLow\nAutoMountIDE\nDTDet\nHeapInit\n0\nMemInit\n0\nVarInit\n0\n\n"
#define TS_CFG CFG_RAM_DRVS CFG_CDROM_DRVS CFG_HARD_DRVS CFG_ACCT CFG_DSK_CACHE CFG_OPTS
#define TS_MENU_CFG CFG_RAM_DRVS CFG_CDROM_DRVS CFG_HARD_DRVS "\n\n" CFG_DSK_CACHE CFG_OPTS
#define TS_CDROM_CFG "b10x20000\nt3 \n\nTS\n\nAutoMountIDE\nDT\n"
//$BK,1$Change these, too...$BK,0$
//$MA+A-X+PU,"STD_DISTRO_CDROM_CFG","F(\"STD_DISTRO_CDROM_CFG\");View;"$
//$LK,"Install Acct","FF:::/TempleOS/Accts/Install/DoItOnce.CPP,MakeOSInstallPrtBootLoader"$
U0 CtrlAltR(I64)
{
static F64 last_time=0;
if (tT-last_time>1.0) {
last_time=tT;
wallpaper_record_on=snd_record=!snd_record;
}
}
SetCtrlAltLetCB('R',&CtrlAltR,"Toggle snd_record");
Bool frame_grabber_on=FALSE;
public U0 MyScreenShot(I64 bits=4)
{
U8 *st;
CDirEntry *tempm;
I64 cnt=0;
tempm=FilesFind("::/Temp/ScreenShots/*.BMP");
while (tempm) {
cnt++;
tempm=tempm->next;
}
st=MSPrintF("::/Temp/ScreenShots/SCRN%04d.BMP",cnt);
BMPFileCaptureScreen(st,bits);
Free(st);
Beep;
}
#define VIDEO_FRAME_RATE 8
U0 FrameGrabberTask(I64)
{
/**** TO MAKE MOVIE ****
TempleOS
<ALT-SHIFT-V>
[Do stuff you want recorded]
<ALT-SHIFT-V>
Boot Windows
Copy /Temp
Download "ffmpeg" from the Internet
>CD SCREENSHOTS
>TSZ -expand .
>ffmpeg -r 8 -i VID%05d.BMP -y Movie.avi
*/
I64 frame_num=0;
U8 buf[136],buf2[136];
F64 end_time=tT,f;
TaskInitExt;
Silent(ON); //no output to screen
MkDir("::/Temp/ScreenShots");
while (frame_grabber_on) {
SPrintF(buf,"::/Temp/ScreenShots/VID%05d.BMP.Z",frame_num++);
StrCpy(buf2,buf);
BMPFileCaptureScreen(buf);
f=tT;
while (end_time<f) {
end_time+=1.0/VIDEO_FRAME_RATE;
if (end_time<f) {
SPrintF(buf,"::/Temp/ScreenShots/VID%05d.BMP.Z",frame_num++);
Copy(buf2,buf);
}
}
LBts(&Fs->task_flags,TASKf_IDLE);
while (sys_cur_scan_code&SCF_NUM) {
Yield;
end_time=tT;
}
while (end_time>tT)
Yield;
LBtr(&Fs->task_flags,TASKf_IDLE);
}
}
U0 CopyVideo()
{
if (ts_has_bak_drv) {
Del(TS_BAK_DRV ":/Temp/*.SND");
SndFileCreate(TS_BAK_DRV ":/Temp/Audio",0.23,0.0,WF_NULL,0.45,0.35);
DelTree(TS_BAK_DRV ":/Temp/ScreenShots");
CopyTree("::/Temp/ScreenShots",TS_BAK_DRV ":/Temp/ScreenShots");
}
}
public U0 FrameGrabberToggle()
{
static F64 last_time=0;
if (tT-last_time>1.0) {
last_time=tT;
if (frame_grabber_on) {
IOSnd(ON);
frame_grabber_on=FALSE;
Snd(0);
wallpaper_record_on=snd_record=FALSE;
Sleep(1000);
CopyVideo;
} else {
IOSnd(OFF); //You don't want to hear screen capture file writes
frame_grabber_on=TRUE;
Spawn(&FrameGrabberTask,NULL,"Frame Grabber");
wallpaper_record_on=snd_record=TRUE;
Snd(0);
}
}
}
U0 ScreenShotTask(I64)
{
TaskInitExt;
MyScreenShot;
}
U0 CtrlAltS(I64)
{
Spawn(&ScreenShotTask);
}
SetCtrlAltLetCB('S',&CtrlAltS,"Cmd/Screen Shot");
public U0 Abbr(U8 *word,U8 *abbr)
{
U8 buf1[136],buf2[136];
StrCpy(buf1,word);
StrCpy(buf2,abbr);
StrUtil(buf1,SUF_TO_LOWER);
StrUtil(buf2,SUF_TO_LOWER);
Grep(buf1,"/TempleOS/"FILENAME_MASK_TXT,"-l-i",buf2);
*buf1=ToUpper(*buf1);
*buf2=ToUpper(*buf2);
Grep(buf1,"/TempleOS/"FILENAME_MASK_TXT,"-l-i",buf2);
StrUtil(buf1,SUF_TO_UPPER);
StrUtil(buf2,SUF_TO_UPPER);
Grep(buf1,"/TempleOS/"FILENAME_MASK_TXT,"-l-i",buf2);
}
public U0 ChkAll()
{
U8 *ptr=TS_HDS;
while (*ptr)
ChkDsk(*ptr++);
}
public U0 MyHAllRep(U8 *flags="-p",U8 *index=NULL)
{
HashRep(Fs->hash_table,HTG_SRC_SYM-HTT_DEFINE_STR-HTT_CLASS,NULL,flags,0,index);
}
public CDoc *DC2Doc(CDC *dc,I64 dx=0,I64 dy=0,I64 *_total_score=NULL)
{
U8 byte_bit_cnts[256],st[2];
I64 i,j,*ptr,row,col,ch,best_ch,score,best_score,cur_char_image,diff_image,total_score=0;
CDoc *doc=DocNew;
MemSet(st,0,sizeof(st));
MemSet(byte_bit_cnts,0,sizeof(byte_bit_cnts));
for (i=0;i<256;i++)
for (j=0;j<7;j++)
if (Bt(&i,j))
byte_bit_cnts[i]++;
for (row=0;row<dc->height/FONT_HEIGHT;row++) {
for (col=0;col<dc->width/FONT_WIDTH;col++) {
cur_char_image=0;
for (i=0;i<FONT_HEIGHT;i++)
for (j=0;j<FONT_WIDTH;j++)
if (GrPeek(dc,col*FONT_WIDTH+j+dx,row*FONT_HEIGHT+i+dy)!=WHITE)
LBts(&cur_char_image,i*8+j);
best_score=MAX_I64;
best_ch=0;
ptr=&gr_font[32*FONT_HEIGHT];
for (ch=32;ch<127;ch++) {
diff_image=*ptr++ ^ cur_char_image;
score=0;
for (i=0;i<8;i++)
score+=byte_bit_cnts[diff_image.u8[i]];
if (score<best_score) {
best_score=score;
best_ch=ch;
}
}
if (best_ch=='$$')
DocPutS(doc,"$$$$");
else {
*st=best_ch;
DocPutS(doc,st);
}
total_score+=best_score;
}
DocPutS(doc,"\n");
}
if (_total_score) *_total_score=total_score;
return doc;
}
public U0 BMP2TXT(U8 *_in_name,U8 *_out_name=NULL)
{
U8 *in_name,*out_name;
I64 dx,dy,score,best_score=MAX_I64;
CDC *dc;
CDoc *doc;
in_name=DftExt(_in_name,"BMP"),
if (_out_name)
out_name=DftExt(_out_name,"TXT.Z");
else
out_name=ChgExt(_in_name,"TXT.Z");
if (dc=BMPFileRead(in_name)) {
for (dy=-3;dy<=4;dy++)
for (dx=-3;dx<=4;dx++) {
doc=DC2Doc(dc,dx,dy,&score);
if (score<best_score) {
best_score=score;
StrCpy(&doc->filename.name,out_name);
DocWrite(doc);
}
DocDel(doc);
}
}
Free(in_name);
Free(out_name);
}
+519
View File
@@ -0,0 +1,519 @@
//The CFG defines are $LK,"Here","FI:::/TempleOS/Demo/AcctExample/TSAdam.CPP"$.
U0 ShowBootFileDate(U8 drv_let)
{
CDirEntry de;
U8 *name=MSPrintF("%c:/Kernel.BIN.C",drv_let);
if (FileFind(name,&de)) {
Free(de.full_name);
"%s %D %T\n",name,de.datetime,de.datetime;
} else
"%s\n",name;
Free(name);
}
U0 ShowBootFiles()
{
U8 *ptr=TS_HDS;
while (*ptr)
ShowBootFileDate(*ptr++);
}
U8 TSPmtDrv()
{
I64 result;
ShowBootFiles;
"Drive:";
result=ToUpper(GetChar);
NewLine;
return result;
}
U0 TSMakeOSInstallPrtBootLoader(U8 drv_let)
{
drv_let=ToUpper(drv_let);
Auto(TS_CFG);
MakeOSInstallPrtBootLoader(drv_let);
if (StrOcc(TS_MASTER_BOOT_DRVS,drv_let))
InstallMasterBootLoader(drv_let);
}
U0 SoftBootMenu(U8 drv_let=0)
{
if (!drv_let)
drv_let=Prt2Drv(Fs->cur_prt);
Drv(drv_let);
Cd("/TempleOS/Kernel");
Auto(TS_MENU_CFG);
if (!Cmp("Kernel","Kernel",NULL,':'))
SoftBoot("Kernel.BIN.Z");
}
U0 TSCopyDrv(U8 src,U8 dst)
{
U8 buf_s[128],buf_d[128];
src=ToUpper(src);
dst=ToUpper(dst);
Fmt(dst,TRUE,FALSE,PT_FAT32);
SPrintF(buf_s,"%c:/TempleOS",src);
SPrintF(buf_d,"%c:/TempleOS",dst);
CopyTree(buf_s,buf_d);
SPrintF(buf_s,"%c:/Windows",src);
SPrintF(buf_d,"%c:/Windows",dst);
CopyTree(buf_s,buf_d);
SPrintF(buf_s,"%c:/Linux",src);
SPrintF(buf_d,"%c:/Linux",dst);
CopyTree(buf_s,buf_d);
SPrintF(buf_s,"%c:/0000Boot",src);
SPrintF(buf_d,"%c:/0000Boot",dst);
CopyTree(buf_s,buf_d);
SPrintF(buf_d,"%c:/Temp",dst);
MkDir(buf_d);
SPrintF(buf_d,"%c:/Temp/ScreenShots",dst);
MkDir(buf_d);
if (ts_has_bak_drv && dst==TS_BAK_DRV_LET) {
SPrintF(buf_d,"%c:/Logs",dst);
MkDir(buf_d);
SPrintF(buf_d,"%c:/Logs/TEMPLEOSLogs",dst);
MkDir(buf_d);
}
DocClear;
Drv(dst);
TSMakeOSInstallPrtBootLoader(dst);
}
U0 TSPmtCopyDrv()
{
U8 src,dst;
"$$FG,RED$$\nCopy Src Drive:\n$$FG$$";
src=TSPmtDrv;
"$$FG,RED$$\nCopy Dst Drive:\n$$FG$$";
dst=TSPmtDrv;
TSCopyDrv(src,dst);
}
public U0 FileCursorRem(U8 *filename)
{
CDoc *doc;
doc=DocRead(filename,DOCF_PLAIN_TEXT|DOCF_NO_CURSOR);
DocWrite(doc);
DocDel(doc);
}
public U0 FileCursorTop(U8 *filename)
{
CDoc *doc;
doc=DocRead(filename,DOCF_PLAIN_TEXT);
doc->cur_entry=doc->root.next;
DocWrite(doc);
DocDel(doc);
}
public U0 FilesCursorRem(U8 *mask="*")
{
I64 fuf_flags=0;
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+T+f+F");
CDirEntry *tempm=FilesFind(mask,fuf_flags),*tempm1;
while (tempm) {
tempm1=tempm->next;
FileCursorRem(tempm->full_name);
Touch(tempm->full_name,"",,tempm->datetime);
CDirEntryDel(tempm);
tempm=tempm1;
}
}
public U0 FilesCursorTop(U8 *mask="*")
{
I64 fuf_flags=0;
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+T+f+F");
CDirEntry *tempm=FilesFind(mask,fuf_flags),*tempm1;
while (tempm) {
tempm1=tempm->next;
FileCursorTop(tempm->full_name);
Touch(tempm->full_name,"",,tempm->datetime);
CDirEntryDel(tempm);
tempm=tempm1;
}
}
U0 UncollapseFile(U8 *filename,I64 *)
{
CDoc *doc=DocRead(filename,DOCF_NO_CURSOR);
DocCollapse(FALSE,doc);
DocWrite(doc);
DocDel(doc);
}
U0 UncollapseLst(CDirEntry *tempm1,I64 *flags)
{
CDirEntry *tempm2;
while (tempm1 && !Bt(flags,FUf_CANCEL)) {
tempm2=tempm1->next;
if (tempm1->attr & _ATTR_DIR) {
if (tempm1->sub) {
"%S %s\n","ST_SCANNING_DIR",tempm1->full_name;
UncollapseLst(tempm1->sub,flags);
}
} else
UncollapseFile(tempm1->full_name,flags);
CDirEntryDel(tempm1);
tempm1=tempm2;
}
}
U0 Uncollapse(U8 *files_find_mask=FILENAME_MASK_TXT,U8 *fu_flags=NULL)
{
I64 f=0;
GetFFlags(&f,Define("ST_FILE_UTIL_FLAGS"),"+r");
GetFFlags(&f,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
UncollapseLst(FilesFind(files_find_mask,f),&f);
}
U0 CopySongDir(U8 *files_find_mask,U8 threshold)
{
CDoc *s;
CDocEntry *doc_e;
CDirEntry *tempm,*tempm1;
tempm1=tempm=FilesFind(files_find_mask);
while (tempm1) {
s=DocRead(tempm1->full_name);
doc_e=s->root.next;
if (doc_e->type_u8==DOCT_TEXT && doc_e->tag[2]>=threshold)
Copy(tempm1->full_name,"/TempleOS/Apps/MusicOrgan/Examples");
tempm1=tempm1->next;
}
CDirLstDel(tempm);
}
public U0 CopySongs(U8 threshold='7')
{
DelTree("/TempleOS/Apps/MusicOrgan/Examples");
MkDir("/TempleOS/Apps/MusicOrgan/Examples");
CopySongDir("/TempleOS/Accts/TS/TAD/MusicOrgan/*.CPP*",threshold);
}
U0 DistroPrep()
{
Del("/TempleOS/Demo/WebLogExample/WebLog.TXT*");
Del("/TempleOS/Demo/GameStarters/EagleDive.BIN*");
DelTree("/TempleOS/Accts/*Temp.TXT.Z");
CopySongs;
//User
Del("/TempleOS/Accts/User/Registry.CPP.Z");
//Install
Del("/TempleOS/Accts/Install/Registry.CPP.Z");
//SafeMode
Del("/TempleOS/Accts/SafeMode/Registry.CPP.Z");
Touch("/TempleOS/Accts/PersonalMenu.TXT.Z","+T");
//TS
Touch("/TempleOS/Accts/TS/PersonalMenu.TXT.Z","+T");
DelTree("/TempleOS/Demo/AcctExample");
CopyTree("/TempleOS/Accts/TS","/TempleOS/Demo/AcctExample");
DelTree("/TempleOS/Demo/AcctExample/TAD/MusicOrgan");
DelTree("/TempleOS/Demo/AcctExample/Wb2");
Del("/TempleOS/Demo/AcctExample/TAD/Test*");
Cd("/TempleOS");
FilesCursorTop;
DelTree("/TempleOS/Demo/*.BI?");
Cd("/TempleOS");
S2T(FILENAME_MASK_SRC,"+r");
DocOpt;
Move(WSD_DEF_FILENAME,WSD_DEF_FILENAME_Z);
}
U0 TSDistroPrep()
{
Drv(TS_MAIN_DRV_LET);
DistroPrep;
Auto(TS_CDROM_CFG);
MakeOSInstallPrtBootLoader(TS_MAIN_DRV_LET,TS_CDROM_DRV_LET);
Fmt(TS_IMG_DRV_LET,TRUE,FALSE,PT_NATIVE);
Drv(TS_IMG_DRV_LET);
CopyTree(TS_MAIN_DRV ":/TempleOS","/TempleOS");
CopyTree(TS_MAIN_DRV ":/Windows","/Windows");
CopyTree(TS_MAIN_DRV ":/Linux","/Linux");
MkDir("/Temp");
MkDir("/Temp/ScreenShots");
CopyTree(TS_MAIN_DRV ":/0000Boot","/0000Boot");
}
U0 MakeSymFiles()
{
CDoc *doc;
U8 *st;
if (ts_has_bak_drv) {
DocClear;
DocMax;
HashRep(Fs->hash_table,HTG_ALL,NULL,"-p",0,NULL);
if (doc=DocCur) {
st=StrNew(doc->filename.name);
StrCpy(doc->filename.name,TS_BAK_DRV ":/Wb/Accts/TS/Wb2/SymsAlpha.TXT.Z");
DocWrite(doc);
StrCpy(doc->filename.name,st);
Free(st);
}
DocClear;
DocMax;
HashRep(Fs->hash_table,HTG_ALL,NULL,"-p+m",0,NULL);
if (doc=DocCur) {
st=StrNew(doc->filename.name);
StrCpy(doc->filename.name,TS_BAK_DRV ":/Wb/Accts/TS/Wb2/SymsAddress.TXT.Z");
DocWrite(doc);
StrCpy(doc->filename.name,st);
Free(st);
}
DocClear;
}
}
I64 MakeLineCntFile()
{
U8 *st;
CDoc *doc;
I64 result;
CDocEntry *tree_branch,*start_indent,*end_indent;
DocClear;
Drv(TS_MAIN_DRV_LET);
DistroPrep;
DocMax;
DocClear;
Cd(TS_MAIN_DRV ":/TempleOS");
result=LineCntRep;
if (doc=DocCur) {
st=StrNew(doc->filename.name);
StrCpy(doc->filename.name,TS_MAIN_DRV ":/TempleOS/Accts/TS/Wb2/LineCnt.TXT.Z");
DocWrite(doc);
StrCpy(doc->filename.name,st);
Free(st);
}
DocClear;
doc=DocRead(TS_MAIN_DRV ":/TempleOS/Adam/DocDefines.CPP.Z");
DocTreeFind(doc,"LineCnt",&tree_branch,&start_indent,&end_indent);
DocCut(doc,start_indent->next,end_indent->last);
doc->cur_entry=start_indent->next;
doc->cur_data_col=0;
DocPrintF(doc,"DefinePrintF(\"DD_TEMPLEOS_LOC\",\"%,d\");\n",result);
st=MSPrintF("%,d",result);
DefineLoad("DD_TEMPLEOS_LOC",st);
Free(st);
DocWrite(doc);
DocDel(doc);
"Total LOC:%12,d\n\n",result;
return result;
}
U0 StdDistroPrep(U8 *auto_cfg)
{
Drv(TS_MAIN_DRV_LET);
DistroPrep;
Auto(auto_cfg);
MakeOSInstallPrtBootLoader(TS_MAIN_DRV_LET,TS_CDROM_DRV_LET);
Fmt(TS_IMG_DRV_LET,TRUE,FALSE,PT_NATIVE);
Drv(TS_IMG_DRV_LET);
CopyTree(TS_MAIN_DRV ":/TempleOS","/TempleOS");
CopyTree(TS_MAIN_DRV ":/Windows","/Windows");
CopyTree(TS_MAIN_DRV ":/Linux","/Linux");
MkDir("/Temp");
DelTree("/TempleOS/Accts/TS");
CopyTree(TS_MAIN_DRV ":/0000Boot","/0000Boot");
Del("/0000Boot/OldMBR.BIN.C");
Del("/0000Boot/BootMHD2.BIN.C");
}
U0 MakeTSDistro()
{
TSDistroPrep;
CDFileCreate(TS_ISO_NAME,TS_IMG_DRV ":/*",NULL,BOOTCD_BIN_Z);
Drv(TS_MAIN_DRV_LET);
}
U0 MakeStdDistro()
{
StdDistroPrep(STD_DISTRO_CDROM_CFG);
CDFileCreate(TS_ISO_NAME,TS_IMG_DRV ":/*",NULL,BOOTCD_BIN_Z);
Drv(TS_MAIN_DRV_LET);
}
U0 TSWebFile(U8 *name)
{
U8 *name2;
CDirEntry de;
if (FileFind(name,&de)) {
Free(de.full_name);
"File:%s\n",name;
UncollapseFile(name,NULL);
Touch(name,"",,de.datetime);
name2=ChgExt(name,"html");
ToHtml(name,name2,
"<title>The Temple Operating System</title>\n"
"<meta name=\"keywords\" content=\"Operating System,64-Bit,64 Bit,Temple,OS,TempleOS,Free,Open Source,Public Domain,x86_64\">\n"
);
Touch(name2,"",,de.datetime);
Free(name2);
}
}
U0 MakeWebSite()
{
CDirEntry *tempm,*tempm2;
if (ts_has_bak_drv) {
DocClear;
Cd(TS_BAK_DRV ":/Wb");
tempm=tempm2=FilesFind(FILENAME_MASK_TXT,FUF_RECURSE|FUF_FLATTEN_TREE|FUF_JUST_FILES);
while (tempm) {
TSWebFile(tempm->full_name);
tempm=tempm->next;
}
CDirLstDel(tempm2);
Drv(TS_MAIN_DRV_LET);
}
}
U0 ToWeb(U8 *name)
{
U8 *st,*st2;
if (ts_has_bak_drv) {
st=FileNameAbs(name);
if (!StrNCmp(st+1,":/TempleOS/",12)) {
st2=MSPrintF(TS_BAK_DRV":/Wb/%s",st+13);
"%s\n",st2;
Copy(name,st2);
TSWebFile(st2);
Free(st2);
}
Free(st);
}
}
U0 TSUncompress()
{
U8 *st;
CDirEntry *tempm,*tempm1;
if (ts_has_bak_drv) {
DelTree(TS_BAK_DRV ":/Uncompressed");
CopyTree(TS_MAIN_DRV ":/TempleOS",TS_BAK_DRV ":/Uncompressed");
tempm=FilesFind(TS_BAK_DRV ":/Uncompressed/*.Z",FUF_RECURSE|FUF_FLATTEN_TREE|FUF_JUST_FILES);
while (tempm) {
tempm1=tempm->next;
st=StrNew(tempm->full_name);
StrLastRem(st,".");
Move(tempm->full_name,st);
Free(st);
CDirEntryDel(tempm);
tempm=tempm1;
}
FilesCursorRem(TS_BAK_DRV ":/Uncompressed/" FILENAME_MASK_TXT);
}
}
U0 MakeDistrosAndBackUp()
{
SettingsPush; //See $LK,"SettingsPush","MN:SettingsPush"$
progress4=*progress4_desc=0;
progress4_max=14;
WordStat;
WinMax;
WinBorder;
ChkAll; progress4++;
if (ts_has_bak_drv) {
MakeLineCntFile; progress4++;
TSCopyDrv(TS_MAIN_DRV_LET,TS_BAK_DRV_LET); progress4++;
DelTree (TS_BAK_DRV ":/Wb"); progress4++;
CopyTree(TS_MAIN_DRV ":/TempleOS",TS_BAK_DRV ":/Wb"); progress4++;
DocClear;
MakeTSDistro; progress4++;
DocClear;
Copy(TS_ISO_NAME,TS_BAK_DRV ":/Wb/TempleOSTS.ISO"); progress4++;
MakeStdDistro; progress4++;
DocClear;
Copy(TS_ISO_NAME,TS_BAK_DRV ":/Wb/TempleOSCD.ISO"); progress4++;
Cd(TS_MAIN_DRV ":/TempleOS");
if (LinkChk)
throw;
progress4++;
MakeSymFiles; progress4++;
MakeWebSite; progress4++;
TSUncompress; progress4++;
}
Drv(TS_MAIN_DRV_LET);
ChkAll; progress4++;
progress4=progress4_max=0;
SettingsPop;
}
public U0 TSMount()
{
if (!sys_auto_mount_ide_cnt) {
Auto(CFG_HARD_DRVS "\n");
Mount;
}
}
U0 TSCopy()
{
if (ts_cid==CID_DFT) {//Dangerous! don't do on my main machine
DelTree(TS_MAIN_DRV ":/TempleOS");
CopyTree(TS_CDROM_DRV ":/",TS_MAIN_DRV ":/");
TSMakeOSInstallPrtBootLoader(TS_MAIN_DRV_LET);
DelTree(TS_BAK_DRV ":/TempleOS");
CopyTree(TS_CDROM_DRV ":/",TS_BAK_DRV ":/");
TSMakeOSInstallPrtBootLoader(TS_BAK_DRV_LET);
Reboot;
}
}
U0 TSPrtDsk()
{
CTask *task=SpawnUser;
CATARep *root=NULL,*ata_drv=NULL,*atapi_drv=NULL;
if (ts_cid==CID_DFT) {//Dangerous! don't do on my main machine
ATARep(FALSE,TRUE,&root);
ATAIDDrvs(root,dft_drv,&ata_drv,&atapi_drv);
if (ata_drv) {
XTalkWait(task,"PrtDsk;\nY%C2p%d\nYYY",TS_MAIN_DRV_LET,ata_drv->num);
XTalkWait(task,"%d\nY\nY\n",(prt_dsk_dsk_size-PRT_HEADER)/2);
}
Kill(task);
}
}
public U0 TSUpgrade()
{
if (ts_cid==CID_DFT) {//Dangerous! don't do on my main machine
TSMount;
TSCopy;
}
}
public U0 TSInstall()
{
if (ts_cid==CID_DFT) {//Dangerous! don't do on my main machine
TSPrtDsk;
TSCopy;
}
}