Skip to content

Commit

Permalink
TempleOSCDV5.00.ISO
Browse files Browse the repository at this point in the history
  • Loading branch information
Terry A. Davis authored and minexew committed Sep 8, 2018
1 parent 122df63 commit f6eacf7
Show file tree
Hide file tree
Showing 374 changed files with 10,900 additions and 11,026 deletions.
Binary file modified 0000Boot/0000Kernel.BIN.C
Binary file not shown.
26 changes: 13 additions & 13 deletions Adam/ABlkDev/FileMgr.HC
Original file line number Diff line number Diff line change
Expand Up @@ -566,22 +566,22 @@ U0 FMRightClick()
}
}

U8 *fm_ip_str=NULL;
U8 *fm_ms_str=NULL;
U0 (*fp_old_final_scrn_update)(CDC *dc);

U0 FMFinalScrnUpdate(CDC *dc)
{
if (fm_ip_str) {
if (fm_ms_str) {
dc->color=LTRED;
GrPrint(dc,ip.pos.x,ip.pos.y,"%s",fm_ip_str);
GrPrint(dc,ms.pos.x,ms.pos.y,"%s",fm_ms_str);
}
(*fp_old_final_scrn_update)(dc);
}

public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
{//File manager. Also, used to choose files and dirs.
CDirEntry *head=NULL,*tmpde,*tmpde1,*tmpde2;
I64 sc,ch,a1,a2,msg_code;
I64 sc,ch,arg1,arg2,msg_code;
CDoc *doc=NULL,*old_put_doc=DocPut,*old_display_doc=DocDisplay;
U8 *res=NULL,*st,*st2,*old_cur_dir=CurDir;
CDocEntry *doc_ce=NULL,*doc_e;
Expand All @@ -600,26 +600,26 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
}
do {
DocUnlock(doc);
do msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|
1<<MSG_IP_R_UP);
do msg_code=GetMsg(&arg1,&arg2,
1<<MSG_KEY_DOWN|1<<MSG_MS_L_DOWN|1<<MSG_MS_L_UP|1<<MSG_MS_R_UP);
while (Fs!=sys_focus_task);
DocLock(doc);
switch (msg_code) {
case MSG_IP_R_UP:
case MSG_MS_R_UP:
DocUnlock(doc);
FMRightClick;
DocLock(doc);
break;
case MSG_IP_L_DOWN:
case MSG_MS_L_DOWN:
doc_ce=doc->cur_entry;
fm_ip_str=doc_ce->tag;
fm_ms_str=doc_ce->tag;
gr.fp_final_scrn_update=&FMFinalScrnUpdate;
break;
case MSG_IP_L_UP:
case MSG_MS_L_UP:
if (doc_ce) {
gr.fp_final_scrn_update=fp_old_final_scrn_update;
if (WinCursorPosSet(Fs,a1+Fs->pix_left+Fs->scroll_x,
a2+Fs->pix_top+Fs->scroll_y,TRUE)) {
if (WinCursorPosSet(Fs,arg1+Fs->pix_left+Fs->scroll_x,
arg2+Fs->pix_top+Fs->scroll_y,TRUE)) {
doc_e=doc->cur_entry;
if (doc_e!=doc_ce) {
st2=NULL;
Expand Down Expand Up @@ -678,7 +678,7 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
break;
case MSG_KEY_DOWN:
doc_ce=NULL;
ch=a1; sc=a2;
ch=arg1; sc=arg2;
if (sc.u8[0]==SC_DELETE && !(sc&(SCF_SHIFT|SCF_CTRL)))
ch=CH_CTRLY;
if (ch && sc&SCF_ALT) goto fm_regular_key;
Expand Down
47 changes: 29 additions & 18 deletions Adam/ABlkDev/Mount.HC
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically);"
I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
U8 Mount2(U8 boot_drv_let,CDoc *_doc,Bool _caller_is_prtdsk)
{//If _doc, called by $LK,"::/Kernel/KCfg.HC"$ else called by $LK,"Mount",A="MN:Mount"$().
I64 cnt,res=0,num_hints,drv_let,type,unit;
I64 cnt,total=0,num_hints,drv_let,type,unit,prt_num;
U8 blks_buf[STR_LEN],addr_buf[STR_LEN],base0_buf[STR_LEN],base1_buf[STR_LEN],
*filename=NULL,*filename2=NULL;
*filename=NULL,*filename2=NULL,res=0;
CATARep *head=NULL,*tmpha;
Bool one_drv,make_free;
Bool whole_drv,make_free;
CDoc *doc;
boot_drv_let=ToUpper(boot_drv_let);
if (boot_drv_let)
boot_drv_let=Let2Let(boot_drv_let);
do {
cnt=0;
if (!_doc)
Expand All @@ -19,10 +20,10 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
"$$GREEN$$Q$$FG$$-$$GREEN$$S$$FG$$ are ISO file write drives.\n"
"$$GREEN$$T$$FG$$-$$GREEN$$Z$$FG$$ are ATAPI CD/DVD drives.\n"
"\nDrive Letter ($$PURPLE$$<ENTER>$$FG$$ to exit):";
drv_let=ToUpper(GetChar);
drv_let=Let2Let(GetChar);
'\n';
if (type=Let2BlkDevType(drv_let)) {
one_drv=FALSE;
whole_drv=FALSE;
if (_doc) { //Called by $LK,"::/Kernel/KCfg.HC"$
doc=_doc;
make_free=FALSE;
Expand All @@ -32,6 +33,7 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
make_free=TRUE;
}
unit=0;
prt_num=MIN_I64;
switch (type) {
case BDT_RAM:
"Addr of RAM disk ($$PURPLE$$<ENTER>$$FG$$ to MAlloc):";
Expand All @@ -44,6 +46,7 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
filename=GetStr("File Name:");
break;
case BDT_ATA:
prt_num=GetI64("Partition Num (Default=All):",prt_num);
case BDT_ATAPI:
num_hints=ATARep(,,&head);
if (type==BDT_ATAPI && boot_drv_let)
Expand Down Expand Up @@ -87,6 +90,8 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
case BDT_ISO_FILE_WRITE:
if (!*blks_buf) StrCpy(blks_buf,"0");
DocPrint(doc,"bd->max_blk=(%s)-1;\n",blks_buf);
DocPrint(doc,"bd->drv_offset=19<<2+"
"(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;\n");
break;
case BDT_ISO_FILE_READ:
filename2=FileNameAbs(filename);
Expand All @@ -102,31 +107,37 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
make_free=TRUE;
} else
DocPrint(doc,"bd->base0=%s;bd->base1=%s;\n",base0_buf,base1_buf);
if (type==BDT_ATA && repartition) {
if (type==BDT_ATA && _caller_is_prtdsk) {
"\nReformat WHOLE drive!";
one_drv=YorN;
whole_drv=YorN;
}
break;
}
DocPrint(doc,"BlkDevAdd(bd,%d,%d);\n",one_drv,make_free);
DocPrint(doc,"BlkDevAdd(bd,%d,%d,%d);\n",prt_num,whole_drv,make_free);
if (_doc) //Called by $LK,"::/Kernel/KCfg.HC"$
cnt++;
else { //Called by $LK,"Mount",A="MN:Mount"$()
if ((cnt=ExeDoc(doc)) && one_drv)
PrtDsk(drv_let);
if ((cnt=ExeDoc(doc)) && whole_drv) {
if (_caller_is_prtdsk) {
res=drv_let;
PrtDsk(drv_let,1.0); //First mount whole drive.
} else
PrtDsk(drv_let);
}
DocDel(doc);
}
}
res+=cnt;
} while (cnt || !res && _doc); //At least 1 if Called by $LK,"::/Kernel/KCfg.HC"$
total+=cnt;
} while (cnt && !_caller_is_prtdsk ||
!total && _doc); //At least 1 if Called by $LK,"::/Kernel/KCfg.HC"$
Free(filename);
Free(filename2);
return res;
}

public I64 Mount(Bool repartition=FALSE)
{//Mount drives.
return Mount2(0,NULL,repartition);
public U8 Mount(Bool caller_is_prtdsk=FALSE)
{//Mount drives. Called from $LK,"PrtDsk(Mount)",A="FF:::/Adam/ABlkDev/PrtDsk.HC,Mount("$.
return Mount2(0,NULL,caller_is_prtdsk);
}

public U0 Unmount(U8 drv_let=0)
Expand All @@ -141,7 +152,7 @@ public U8 MountFile(U8 *filename)
CBlkDev *bd=BlkDevNextFreeSlot(dv->drv_let,BDT_ISO_FILE_READ);
bd->drv_offset=19<<2+(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;
bd->file_dsk_name=AStrNew(filename3);
BlkDevAdd(bd,TRUE,TRUE);
BlkDevAdd(bd,,TRUE,TRUE);
Free(filename3);
Free(filename2);
return dv->drv_let;
Expand Down
52 changes: 28 additions & 24 deletions Adam/ABlkDev/PrtDsk.HC
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ class CPlannedDrv
Bool pri;
};

//Available to assist in writing scripts.
I64 drv_dsk_dsk_size=0;
public I64 PrtDsk(U8 drv_let=0,...)
{/*Partition the disk containing partition drv_let.
public I64 PrtDsk(U8 drv_let=0)
{//Partition the disk containing partition drv_let.
//drv_let=0 means add new drive that
//is not already mounted.
drv_let=0 means add new drive that is not already mounted.
>PrtDsk('C',0.5,0.25,0.25); //Make three. 50% C, 25% D, 25% E, round-up to blk.
*/
CBlkDev *bd;
CPlannedDrv head,*tmppp;
CMasterBoot mbr;
Bool pri=TRUE;
I64 ext_base,drv_let2,pri_cnt=0,
i,start_offset,offset,remaining;
drv_dsk_dsk_size=0;
I64 ext_base,drv_let2,pri_cnt=0,i,start_offset,offset,
total,remaining,cur_arg=0;
"This command does not play well\n"
"with other operating systems.\n"
"You really should use another\n"
Expand All @@ -34,17 +34,17 @@ public I64 PrtDsk(U8 drv_let=0)
"until you set block zero to zero\n"
"with $$LK,\"BootMHDZero\",\"MN:BootMHDZero\"$$()\n\n\n"
"Continue";
if (!YorN) return 0;
if (argc<=cur_arg && !YorN)
return 0;
'\n';

if (drv_let && !Let2BlkDev(drv_let,FALSE))
drv_let=0;
if (!drv_let) {
Mount(TRUE);
return 0;
}
if (!(bd=Let2BlkDev(drv_let,FALSE)) || bd->type!=BDT_ATA)
if (!drv_let && !(drv_let=Mount(TRUE)) ||
!(bd=Let2BlkDev(drv_let,FALSE)) || bd->type!=BDT_ATA)
return 0;

drv_dsk_dsk_size=bd->max_blk+1;
total=bd->max_blk+1;
QueInit(&head);
drv_let2=bd->first_drv_let;
remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO);
Expand All @@ -55,18 +55,22 @@ public I64 PrtDsk(U8 drv_let=0)
tmppp->pri=FALSE;
if (pri) {
"Primary Partition";
if (YorN) {
if (argc>cur_arg || YorN) {
pri_cnt++;
tmppp->pri=TRUE;
if (pri_cnt==3)
pri=FALSE;
} else
pri=FALSE;
}
"Blocks Remaining:%d (0x%X)\n",
"\nBlocks Remaining:%d (0x%X)\n",
remaining-DRV_HEADER,remaining-DRV_HEADER;
tmppp->size=CeilU64(GetI64("Size in Blocks :",
remaining-DRV_HEADER)+DRV_HEADER,ROUND_DRV_TO);
if (argc>cur_arg)
tmppp->size=MinI64(CeilU64(MaxI64(remaining,DRV_HEADER),ROUND_DRV_TO),
CeilU64(argv[cur_arg++](F64)*total,ROUND_DRV_TO));
else
tmppp->size=CeilU64(GetI64("Size in Blocks :",
remaining-DRV_HEADER)+DRV_HEADER,ROUND_DRV_TO);
} while (!(ROUND_DRV_TO<=tmppp->size<=FloorU64(remaining,ROUND_DRV_TO)));
QueIns(tmppp,head.last);
remaining-=tmppp->size;
Expand All @@ -85,7 +89,7 @@ public I64 PrtDsk(U8 drv_let=0)
tmppp=tmppp->next;
drv_let2++;
}
if (!AreYouSure)
if (!argc && !AreYouSure)
goto pd_done;

remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO)-ROUND_DRV_TO;
Expand Down Expand Up @@ -149,15 +153,15 @@ public I64 PrtDsk(U8 drv_let=0)
}

bd->flags&=~(BDF_INITIALIZED | BDF_INIT_IN_PROGRESS);
BlkDevAdd(bd,FALSE,TRUE);
BlkDevAdd(bd,,FALSE,TRUE);
for (i=bd->first_drv_let;i<drv_let2;i++)
Fmt(i,,FALSE);

pd_done:
pd_done:
while (head.next!=&head) {
tmppp=head.next;
QueRem(tmppp);
Free(tmppp);
}
return drv_dsk_dsk_size;
return total;
}
16 changes: 9 additions & 7 deletions Adam/ADefine.HC
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

U0 LoadDocDefines()
{
CBinFile *bfh=sys_boot_base-sizeof(CBinFile);
CBinFile *bfh=mem_boot_base-sizeof(CBinFile);

DefinePrint("DD_OS_NAME_VERSION","TempleOS V%0.2f",sys_os_version);
DefinePrint("DD_TEMPLEOS_AGE","%0.1f",
Expand All @@ -11,8 +11,8 @@ U0 LoadDocDefines()
//This is cut and replaced when I generate a distro.
//See $LK,"DD_TEMPLEOS_LOC",A="FF:::/Demo/AcctExample/TOSDistro.HC,DD_TEMPLEOS_LOC"$.
$TR-C,"LineRep"$
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","120,770");
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","81,303");
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","119,466");
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","81,791");
$ID,-4$
DefinePrint("DD_KERNEL","%08X",bfh);
bfh(I64)+=bfh->file_size-1;
Expand All @@ -27,12 +27,14 @@ $ID,-4$
DefinePrint("DD_SYS_FIXED_AREA_BASE","%08X",SYS_FIXED_AREA);
DefinePrint("DD_SYS_FIXED_AREA_END","%08X",
SYS_FIXED_AREA+sizeof(CSysFixedArea)-1);
DefinePrint("DD_SYS_HEAP_BASE","%08X",sys_heap_base);
DefinePrint("DD_SYS_HEAP_LIMIT","%08X",sys_heap_limit);
DefinePrint("DD_MEM_HEAP_BASE","%08X",mem_heap_base);
DefinePrint("DD_MEM_HEAP_LIMIT","%08X",mem_heap_limit);
DefinePrint("DD_MEM_MIN_MEG","%dMeg",MEM_MIN_MEG);
DefinePrint("DD_UNCACHED_ALIAS","%010X",dev.uncached_alias);
DefinePrint("DD_MEM_MAPPED_SPACE_GIG","%dGig",MEM_MAPPED_SPACE/0x40000000);
DefinePrint("DD_MEM_MAPPED_SPACE_END","%010X",MEM_MAPPED_SPACE-1);
DefinePrint("DD_PHYSICAL_SPACE_END","%010X",
mem_physical_space-1);
DefinePrint("DD_MAPPED_SPACE_END","%010X",
mem_mapped_space-1);
DefinePrint("DD_JIFFY_HZ","%dHz",JIFFY_FREQ);
}

Expand Down
7 changes: 4 additions & 3 deletions Adam/AExts.HC
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ extern CMenuEntry *MenuEntryFind(CMenu *haystack_menu,U8 *needle_full_name);
extern CMenu *MenuFilePush(U8 *filename);
extern U0 MenuPop();
extern CMenu *MenuPush(U8 *st);
extern I64 Mount(Bool repartition=FALSE);
extern CTask *Noise(I64 ms,F64 min_freq,F64 max_freq);
extern U8 Mount(Bool caller_is_prtdsk=FALSE);
extern CTask *Noise(I64 mS,F64 min_ona,F64 max_ona);
extern Bool Plain(U8 *filename,I64 edf_dof_flags=0);
extern Bool PopUpCancelOk(U8 *header=NULL,U8 *footer=NULL);
extern I64 PopUpColor(U8 *header=NULL,
Expand All @@ -80,14 +80,15 @@ extern I64 PopUpRangeI64(
extern Bool PopUpTransform(I64 *r);
extern U0 Refresh(I64 cnt=1,Bool force=FALSE);
extern U0 RegOneTimePopUp(I64 flag_num,U8 *msg);
extern Bool RegWrite(U8 *path,U8 *fmt,...);
extern U0 SettingsPop(CTask *task=NULL,I64 flags=0);
extern CTaskSettings *SettingsPush(CTask *task=NULL,I64 flags=0);
extern U0 TemplateCtrlSlider(CDoc *doc);
extern Bool View();
extern U0 ViewAnglesDel(CTask *task=NULL);
extern CCtrl *ViewAnglesNew(CTask *task=NULL);
extern Bool WinBorder(Bool val=OFF,CTask *task=NULL);
extern CDoc *WinCursorPosSet(CTask *task,I64 ipx,I64 ipy,Bool set_cursor=TRUE);
extern CDoc *WinCursorPosSet(CTask *task,I64 msx,I64 msy,Bool set_cursor=TRUE);
extern Bool WinHorz(I64 left,I64 right,CTask *task=NULL);
extern U0 WinMax(CTask *task=NULL);
extern U0 WinScrollNull(CTask *task,CD3I64 *s);
Expand Down
12 changes: 6 additions & 6 deletions Adam/AMath.HC
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ public Complex *CMul(Complex *prod,Complex *n1,Complex *n2)

public Complex *CDiv(Complex *quot,Complex *n1,Complex *n2)
{//quot=n1/n2
F64 m1,a1,m2,a2;
R2P(&m1,&a1,n1->x,n1->y);
R2P(&m2,&a2,n2->x,n2->y);
F64 m1,arg1,m2,arg2;
R2P(&m1,&arg1,n1->x,n1->y);
R2P(&m2,&arg2,n2->x,n2->y);
m1/=m2;
a1-=a2;
quot->x=m1*Cos(a1);
quot->y=m1*Sin(a1);
arg1-=arg2;
quot->x=m1*Cos(arg1);
quot->y=m1*Sin(arg1);
return quot;
}

Expand Down
2 changes: 1 addition & 1 deletion Adam/AMem.HC
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public Bool IsInHeapCtrl(U8 *a,CHeapCtrl *hc,Bool lock=TRUE)
PAUSE
m=hc->next_mem_blk;
while (m!=&hc->next_mem_blk) {
if (a>=m && a<m(U8 *)+m->pages<<MEM_PAGE_BITS) {
if (a>=m && a<m(U8 *)+m->pags<<MEM_PAG_BITS) {
if (lock)
LBtr(&hc->locked_flags,HClf_LOCKED);
POPFD
Expand Down
Binary file renamed Adam/AInputPointer.HC → Adam/AMouse.HC
Binary file not shown.
Loading

0 comments on commit f6eacf7

Please sign in to comment.