Browse Source

TempleOSCDV4.09.ISO

v6
Terry A. Davis 6 years ago committed by minexew
parent
commit
353eac0dbe
  1. BIN
      0000Boot/0000Kernel.BIN.C
  2. 52
      Adam/ABlkDev/FileMgr.CPP
  3. 41
      Adam/ABlkDev/Mount.CPP
  4. 2
      Adam/ABlkDev/PrtDsk.CPP
  5. 4
      Adam/ADefine.CPP
  6. 21
      Adam/DolDoc/DocPopUp.CPP
  7. 24
      Adam/DolDoc/DocTerm.CPP
  8. 6
      Adam/DolDoc/DocTree.CPP
  9. 642
      Adam/Gr/GrPrimatives.CPP
  10. 1
      Adam/Opt/Boot/BootDVD.CPP
  11. 33
      Adam/Opt/Boot/BootDVDIns.CPP
  12. 4
      Adam/Opt/Boot/BootHD.CPP
  13. 60
      Adam/Opt/Boot/BootHDIns.CPP
  14. 4
      Adam/Opt/Boot/BootMHD.CPP
  15. 99
      Adam/Opt/Boot/BootMHDIns.CPP
  16. 2
      Adam/Opt/Boot/BootRAM.CPP
  17. 73
      Adam/Opt/Boot/DskISORedSea.CPP
  18. 12
      Adam/Opt/Boot/MakeBoot.CPP
  19. 42
      Adam/Opt/Utils/MemRep.CPP
  20. 8
      Adam/TaskRep.CPP
  21. BIN
      Adam/WallPaper.CPP
  22. 6
      Compiler/AsmResolve.CPP
  23. 32
      Compiler/CMain.CPP
  24. 53
      Compiler/CMisc.CPP
  25. BIN
      Compiler/Compiler.BIN
  26. 422
      Compiler/Compiler.MAP
  27. 3
      Compiler/CompilerA.HPP
  28. 3
      Compiler/CompilerB.HPP
  29. 1
      Compiler/OptPass789A.CPP
  30. 14
      Compiler/PrsExp.CPP
  31. 5
      Compiler/PrsLib.CPP
  32. 57
      Compiler/PrsStmt.CPP
  33. 6
      Demo/AcctExample/DoOnce.CPP
  34. 1
      Demo/AcctExample/MakeHome.CPP
  35. BIN
      Demo/AcctExample/PersonalMenu.TXT
  36. 8
      Demo/AcctExample/PersonalNotes.TXT
  37. 36
      Demo/AcctExample/Registry.CPP
  38. 36
      Demo/AcctExample/TOSDistro.CPP
  39. 6
      Demo/AcctExample/TOSHolySpirit.CPP
  40. 4
      Demo/AcctExample/TOSToHtml.CPP
  41. 4
      Demo/Asm/DivByHand.CPP
  42. 111
      Demo/Games/EagleDive.CPP
  43. 2
      Demo/Graphics/FontEd.CPP
  44. 2
      Demo/Lectures/MiniCompiler.CPP
  45. 1
      Demo/MagicPairs.CPP
  46. 2
      Demo/ToHtmlToTXTDemo/ToHtml.CPP
  47. 3
      DoOnce.CPP
  48. 2
      Doc/AutoFile.TXT
  49. BIN
      Doc/Boot.TXT
  50. 25
      Doc/ChangeLog.TXT
  51. 2
      Doc/DbgOverview.TXT
  52. 6
      Doc/Directives.TXT
  53. 4
      Doc/FAQ.TXT
  54. 6
      Doc/FileMgr.TXT
  55. 8
      Doc/Glossary.TXT
  56. 2
      Doc/Grub.TXT
  57. 4
      Doc/GuideLines.TXT
  58. BIN
      Doc/HelpIndex.TXT
  59. 8
      Doc/Install.TXT
  60. 4
      Doc/Tips.TXT
  61. 2
      Doc/Upgrade.TXT
  62. 2
      Kernel/BlkDev/DskATAId.CPP
  63. 16
      Kernel/BlkDev/DskAddDev.CPP
  64. 6
      Kernel/BlkDev/DskBlk.CPP
  65. 92
      Kernel/BlkDev/DskBlkDev.CPP
  66. 42
      Kernel/BlkDev/DskDrv.CPP
  67. 26
      Kernel/FunSeg.CPP
  68. 8
      Kernel/KDbg.CPP
  69. 3
      Kernel/KDefine.CPP
  70. 5
      Kernel/KExts.CPP
  71. 4
      Kernel/KHashB.CPP
  72. 2
      Kernel/KLoad.CPP
  73. 10
      Kernel/KStart.CPP
  74. 4
      Kernel/KTask.CPP
  75. 11
      Kernel/KUtils.CPP
  76. 2110
      Kernel/Kernel.MAP
  77. 4
      Kernel/Kernel.PRJ
  78. 37
      Kernel/KernelA.HPP
  79. 2
      Kernel/KernelB.HPP
  80. 18
      Kernel/KernelC.HPP
  81. 2
      Kernel/Mem/MemPhysical.CPP
  82. 10
      Kernel/SrvCmd.CPP
  83. 23
      Kernel/StrPrint.CPP
  84. 8
      Misc/DoDistro.CPP
  85. 10
      Misc/OSInstall.CPP
  86. 4
      Misc/Tour/Tour6.AUT
  87. BIN
      PersonalMenu.TXT
  88. 2
      StartOS.CPP

BIN
0000Boot/0000Kernel.BIN.C

Binary file not shown.

52
Adam/ABlkDev/FileMgr.CPP

@ -323,7 +323,7 @@ U0 FMDelete(CDoc *doc)
}
}
U0 FMMount(CDoc *doc)
U0 FMChgDsk(CDoc *doc)
{
CDocEntry *doc_ce=doc->cur_entry;
CDirEntry *tempde;
@ -340,6 +340,32 @@ U0 FMMount(CDoc *doc)
}
}
U0 FMMountISO(CDoc *doc)
{
CDocEntry *doc_ce=doc->cur_entry;
CDirEntry *tempde;
if (doc_ce->type_u8==DOCT_MENU_VAL && (tempde=doc_ce->user_data))
MountFile(tempde->full_name);
}
U0 FMUnmount(CDoc *doc)
{
CDocEntry *doc_ce=doc->cur_entry;
CDirEntry *tempde;
I64 drv_let;
if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
tempde=doc_ce->user_data;
else
tempde=NULL;
if (tempde) {
while (tempde->parent)
tempde=tempde->parent;
drv_let=*tempde->full_name;
if (Let2BlkDev(drv_let)!=Let2BlkDev(':'))
Unmount(drv_let);
}
}
U0 FMFmtDrv(CDoc *doc)
{
CDocEntry *doc_ce=doc->cur_entry;
@ -460,9 +486,11 @@ U0 FMCopy(CDoc *doc)
#define FMR_PASTE 6
#define FMR_CHG_DSK 7
#define FMR_FORMAT 8
#define FMR_MAKE_ISO 9
#define FMR_BURN_ISO 10
#define FMR_HELP 11
#define FMR_MOUNT_ISO 9
#define FMR_UNMOUNT 10
#define FMR_MAKE_ISO 11
#define FMR_BURN_ISO 12
#define FMR_HELP 13
I64 PopUpFMRight(U8 *header=NULL,U8 *footer=NULL)
{
@ -478,6 +506,8 @@ I64 PopUpFMRight(U8 *header=NULL,U8 *footer=NULL)
"$$CM+LX,1,3 $$$$BT,\"PASTE CLIPBOARD FILES \",LE=FMR_PASTE$$"
"$$CM+LX,27,0$$$$BT,\"CHANGE DISK(MOUNT IT) \",LE=FMR_CHG_DSK$$"
"$$CM+LX,1,3 $$$$BT,\"FORMAT \",LE=FMR_FORMAT$$"
"$$CM+LX,1,3 $$$$BT,\"MOUNT ISO.C FILE \",LE=FMR_MOUNT_ISO$$"
"$$CM+LX,27,0$$$$BT,\"UNMOUNT \",LE=FMR_UNMOUNT$$"
"$$CM+LX,1,3 $$$$BT,\"MAKE ISO (CD/DVD) FILE\",LE=FMR_MAKE_ISO$$"
"$$CM+LX,27,0$$$$BT,\"BURN ISO (CD/DVD) FILE\",LE=FMR_BURN_ISO$$"
"$$CM+LX,1,3 $$$$BT,\"HELP \",LE=FMR_HELP$$"
@ -518,6 +548,12 @@ U0 FMRightClick()
case FMR_FORMAT:
Msg(MSG_KEY_DOWN,'f',0);
break;
case FMR_MOUNT_ISO:
Msg(MSG_KEY_DOWN,'i',0);
break;
case FMR_UNMOUNT:
Msg(MSG_KEY_DOWN,'u',0);
break;
case FMR_MAKE_ISO:
Msg(MSG_KEY_DOWN,'M',0);
break;
@ -667,7 +703,13 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
FMDelete(doc);
break;
case 'm':
FMMount(doc);
FMChgDsk(doc);
break;
case 'i':
FMMountISO(doc);
break;
case 'u':
FMUnmount(doc);
break;
case 'M':
FMMakeISO(doc);

41
Adam/ABlkDev/Mount.CPP

@ -2,7 +2,8 @@
I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
{//If _doc, called by $LK,"::/Kernel/KCfg.CPP"$ else called by $LK,"Mount",A="MN:Mount"$().
I64 cnt,res=0,num_hints,drv_let,type,unit;
U8 blks_buf[STR_LEN],addr_buf[STR_LEN],base0_buf[STR_LEN],base1_buf[STR_LEN];
U8 blks_buf[STR_LEN],addr_buf[STR_LEN],base0_buf[STR_LEN],base1_buf[STR_LEN],
*filename=NULL,*filename2=NULL;
CATARep *root=NULL,*tempha;
Bool one_drv,make_free;
CDoc *doc;
@ -14,7 +15,8 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
"\n****** Mount Drives ******\n"
"$$GREEN$$A$$FG$$-$$GREEN$$B$$FG$$ are RAM drives.\n"
"$$GREEN$$C$$FG$$-$$GREEN$$L$$FG$$ are ATA hard drives.\n"
"$$GREEN$$M$$FG$$-$$GREEN$$S$$FG$$ are file drives.\n"
"$$GREEN$$M$$FG$$-$$GREEN$$P$$FG$$ are file read drives.\n"
"$$GREEN$$Q$$FG$$-$$GREEN$$S$$FG$$ are 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);
@ -34,10 +36,13 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
case BDT_RAM:
"Addr of RAM disk ($$PURPLE$$<ENTER>$$FG$$ to MAlloc):";
GetS(addr_buf,STR_LEN);
case BDT_FILE:
case BDT_FILE_WRITE:
"Blks of 512 bytes:";
GetS(blks_buf,STR_LEN);
break;
case BDT_FILE_READ:
filename=GetStr("File Name:");
break;
case BDT_ATA:
case BDT_ATAPI:
num_hints=ATARep(,,&root);
@ -73,16 +78,22 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
LinkedLstDel(root);
break;
}
DocPrint(doc,"bd=BlkDevNextFree(\'%C\',%d);bd->unit=%d;\n",
DocPrint(doc,"bd=BlkDevNextFreeSlot(\'%C\',%d);bd->unit=%d;\n",
drv_let,type,unit);
switch (type) {
case BDT_RAM:
if (!*addr_buf) StrCpy(addr_buf,"0");
DocPrint(doc,"bd->RAM_dsk=%s;\n",addr_buf);
case BDT_FILE:
case BDT_FILE_WRITE:
if (!*blks_buf) StrCpy(blks_buf,"0");
DocPrint(doc,"bd->max_blk=(%s)-1;\n",blks_buf);
break;
case BDT_FILE_READ:
filename2=FileNameAbs(filename);
DocPrint(doc,"bd->file_dsk_name=AStrNew(\"%s\");\n",filename2);
DocPrint(doc,"bd->drv_offset=19<<2+"
"(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;\n");
break;
case BDT_ATA:
case BDT_ATAPI:
if (type==BDT_ATAPI && !*base0_buf) {
@ -108,6 +119,8 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
}
res+=cnt;
} while (cnt || !res && _doc); //At least 1 if Called by $LK,"::/Kernel/KCfg.CPP"$
Free(filename);
Free(filename2);
return res;
}
@ -115,3 +128,21 @@ public I64 Mount(Bool repartition=FALSE)
{//Mount drives.
return Mount2(0,NULL,repartition);
}
public U0 Unmount(U8 drv_let=0)
{//Unmount drive(s).
BlkDevDel(Let2BlkDev(drv_let));
}
public U8 MountFile(U8 *filename)
{//Mount ISO.C file.
U8 *filename2=DftExt(filename,"ISO.C"),*filename3=FileNameAbs(filename2);
CDrv *dv=DrvMakeFreeSlot(DrvNextFreeLet('M')); //First $LK,"BDT_FILE_READ",A="MN:BDT_FILE_READ"$
CBlkDev *bd=BlkDevNextFreeSlot(dv->drv_let,BDT_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);
Free(filename3);
Free(filename2);
return dv->drv_let;
}

2
Adam/ABlkDev/PrtDsk.CPP

@ -32,7 +32,7 @@ public I64 PrtDsk(U8 drv_let=0)
"make your hard drive impossible\n"
"to repartition with other operating\n"
"until you set block zero to zero\n"
"with $$LK,\"MasterBootZero\",\"MN:MasterBootZero\"$$()\n\n\n"
"with $$LK,\"BootMHDZero\",\"MN:BootMHDZero\"$$()\n\n\n"
"Continue";
if (!YorN) return 0;
if (drv_let && !Let2BlkDev(drv_let,FALSE))

4
Adam/ADefine.CPP

@ -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.CPP,DD_TEMPLEOS_LOC"$.
$TR-C,"LineRep"$
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","120,845");
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","80,741");
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","121,194");
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","81,057");
$ID,-4$
DefinePrint("DD_KERNEL","%08X",bfh);
bfh(I64)+=bfh->file_size-1;

21
Adam/DolDoc/DocPopUp.CPP

@ -265,9 +265,9 @@ public F64 PopUpRangeF64Log(F64 lo,F64 hi,I64 steps,
return PopUpRangeF64Exp(lo,hi,Exp(Ln(hi/lo)/(steps-1)),fmt,header,footer);
}
#help_index "Task/Srv/Exe"
#help_index "Task/Srv/Exe;Compiler"
public I64 AdamFile(U8 *filename,Bool warn_ext=TRUE)
{//Tell adam task to compile and run a file.
{//Make adam_task execute file.
Bool okay=TRUE;
U8 *name=FileNameAbs(filename),
*name2=DftExt(name,"CPP.Z");
@ -285,7 +285,7 @@ public I64 AdamFile(U8 *filename,Bool warn_ext=TRUE)
public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,
CTask *parent=NULL,CTask **_pu_task=NULL)
{//Run code file in PopUp win task.
{//$LK,"ExeFile2",A="MN:ExeFile2"$() in $LK,"PopUp",A="MN:PopUp"$ task. Cont as User.
Bool okay=TRUE;
U8 *st,*name=FileNameAbs(filename),
*name2=DftExt(name,"CPP.Z");
@ -306,3 +306,18 @@ public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,
Free(name);
return res;
}
public I64 PopUpRunFile(U8 *filename,I64 ccf_flags=0,...)
{//$LK,"ExeFile",A="MN:ExeFile"$() with args using $LK,"LastFun",A="MN:LastFun"$() in $LK,"PopUp",A="MN:PopUp"$ task.
U8 *st,*name=FileNameAbs(filename),
*name2=DftExt(name,"CPP.Z");
I64 res=0;
st=MStrPrint(
"\"$$$$WW+H,1$$$$\";ExeFile2(\"%s\",0x%X);LastFun(0x%X,0x%X);",
name2,ccf_flags,argc,argv);
res=PopUp(st,Fs);
Free(st);
Free(name2);
Free(name);
return res;
}

24
Adam/DolDoc/DocTerm.CPP

@ -59,8 +59,9 @@ public U0 DocTermNew()
#define RIGHT_DELETE 4
#define RIGHT_TYPE 5
#define RIGHT_ED 6
#define RIGHT_PLAIN 7
#define RIGHT_AUTOFILE 8
#define RIGHT_MOUNT 7
#define RIGHT_PLAIN 8
#define RIGHT_AUTOFILE 9
I64 PopUpTermRight(U8 *header)
{
@ -76,9 +77,10 @@ I64 PopUpTermRight(U8 *header)
"$$CM+LX,1,3 $$$$BT,\"DELETE \",LE=RIGHT_DELETE$$"
"$$CM+LX,26,0$$$$BT,\"TYPE TXT;GRA\",LE=RIGHT_TYPE$$"
"$$CM+LX,1,3 $$$$BT,\"ED TXT\",LE=RIGHT_ED$$"
"$$CM+LX,26,0$$$$BT,\"PLAIN ED TXT\",LE=RIGHT_PLAIN$$"
"$$CM+LX,1,3 $$$$BT,\"CANCEL \",LE=DOCM_CANCEL$$"
"$$CM+LX,26,0$$$$BT,\"AUTOFILE AUT\",LE=RIGHT_AUTOFILE$$\n",
"$$CM+LX,26,0$$$$BT,\"MOUNT ISO.C\",LE=RIGHT_MOUNT$$"
"$$CM+LX,1,3 $$$$BT,\"PLAIN ED TXT\",LE=RIGHT_PLAIN$$"
"$$CM+LX,26,0$$$$BT,\"AUTOFILE AUT\",LE=RIGHT_AUTOFILE$$\n"
"$$CM+LX,1,3 $$$$BT,\"CANCEL \",LE=DOCM_CANCEL$$",
FILEMASK_TXT,FILEMASK_JIT,FILEMASK_GRA);
i=PopUpMenu(doc);
DocDel(doc);
@ -160,6 +162,18 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
"Ed(\"%s\");\n$$PT$$$$FG$$$$BG$$",st;
res=Ed(st);
break;
case RIGHT_MOUNT:
if (FileExtDot(st) && !FilesFindMatch(st,"*.ISO.C")) {
if (!PopUpCancelOk(ST_WARN_ST "Not .ISO.C File\n\n")) {
send_new_line=TRUE;
break;
}
}
"MountFile(\"%s\");\n$$PT$$$$FG$$$$BG$$",st;
WinZBufUpdate;
MountFile(st);
res=TRUE;
break;
case RIGHT_PLAIN:
"Plain(\"%s\");\n$$PT$$$$FG$$$$BG$$",st;
res=Plain(st);

6
Adam/DolDoc/DocTree.CPP

@ -119,9 +119,9 @@ public I64 ExeDoc(CDoc *doc,I64 ccf_flags=0)
I64 res;
Bool okay=TRUE,unlock_doc=DocLock(doc);
CCmpCtrl *cc=CmpCtrlNew(,ccf_flags|CCF_DONT_FREE_BUF);
if (Fs->last_lex!=&Fs->next_lex)
cc->opts=Fs->last_lex->opts;
QueIns(cc,Fs->last_lex);
if (Fs->last_cc!=&Fs->next_cc)
cc->opts=Fs->last_cc->opts;
QueIns(cc,Fs->last_cc);
LexAttachDoc(cc,,doc);
try {
Lex(cc);

642
Adam/Gr/GrPrimatives.CPP

@ -1396,313 +1396,425 @@ gr_done:
public I64 GrFillTri0(CDC *dc=gr.dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p4)
{//3D. Returns cnt of pixs changed
I64 x1,x2,y,z1,z2,dx1,dy1,dz1,dx2,dy2,dz2,res=0,i,y_min,y_max;
I64 x1,x2,y1,y2,z1,z2,dx1,dy1,dz1,dx2,dy2,dz2,res=0,i,min,max;
CTask *win_task;
//p1 is min x
if (p4->x<p2->x)
SwapI64(&p4,&p2);
if (p2->x<p1->x)
SwapI64(&p2,&p1);
//p2y<=p4y
if (p4->y<p2->y)
SwapI64(&p4,&p2);
y_min=0;
y_max=dc->height;
if (dc->flags & DCF_SCREEN_BITMAP) {
win_task=dc->win_task;
y_min-=win_task->scroll_y+win_task->pix_top;
y_max-=win_task->scroll_y+win_task->pix_top;
if (y_max>win_task->pix_bottom-(win_task->scroll_y+win_task->pix_top))
y_max=win_task->pix_bottom-(win_task->scroll_y+win_task->pix_top);
}
if ((dy2=p4->y-p1->y)<0) {
/*
p1x<= {p2x,p4x}
p2y<=
p4y<
p1y
6
1
6
1
24
1
42
1
2
4
1
if (AbsI64(p1->y-p2->y)+AbsI64(p1->y-p4->y)<=
AbsI64(p1->x-p2->x)+AbsI64(p1->x-p4->x)) {
//p1 is min x
if (p4->x<p2->x)
SwapI64(&p4,&p2);
if (p2->x<p1->x)
SwapI64(&p2,&p1);
24
1
//p2y<=p4y
if (p4->y<p2->y)
SwapI64(&p4,&p2);
42
1
min=0;
max=dc->height;
if (dc->flags & DCF_SCREEN_BITMAP) {
win_task=dc->win_task;
min-=win_task->scroll_y+win_task->pix_top;
max-=win_task->scroll_y+win_task->pix_top;
if (max>win_task->pix_bottom-(win_task->scroll_y+win_task->pix_top))
max=win_task->pix_bottom-(win_task->scroll_y+win_task->pix_top);
}
2
4
1
if ((dy2=p4->y-p1->y)<0) {
dy1=p2->y-p1->y;
dx1=(p1->x-p2->x)<<32/dy1;
dz1=(p1->z-p2->z)<<32/dy1;
*/
dy1=p2->y-p1->y;
dx1=(p1->x-p2->x)<<32/dy1;
dz1=(p1->z-p2->z)<<32/dy1;
dx2=(p1->x-p4->x)<<32/dy2;
dz2=(p1->z-p4->z)<<32/dy2;
x1=x2=p1->x<<32; y=p1->y; z1=z2=p1->z<<32;
if (y+dy2<y_min) {
i=y_min-(y+dy2);
if (i>-dy2) goto ft_done;
dy2+=i;
}
if (y>=y_max) {
i=y-y_max+1;
if (i>-dy2)
i=-dy2;
dy2+=i;
y-=i;
x1+=dx1*i;
x2+=dx2*i;
z1+=dz1*i;
z2+=dz2*i;
}
while (dy2++) {
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
y--;
x1+=dx1;
x2+=dx2;
z1+=dz1;
z2+=dz2;
}
if (dy2=p2->y-p4->y) {
dx2=(p4->x-p2->x)<<32/dy2;
dz2=(p4->z-p2->z)<<32/dy2;
if (y+dy2<y_min) {
i=y_min-(y+dy2);
dx2=(p1->x-p4->x)<<32/dy2;
dz2=(p1->z-p4->z)<<32/dy2;
x1=x2=p1->x<<32; y1=p1->y; z1=z2=p1->z<<32;
if (y1+dy2<min) {
i=min-(y1+dy2);
if (i>-dy2) goto ft_done;
dy2+=i;
}
if (y>=y_max) {
i=y-y_max+1;
if (i>-dy2) goto ft_done;
if (y1>=max) {
i=y1-max+1;
if (i>-dy2)
i=-dy2;
dy2+=i;
y-=i;
y1-=i;
x1+=dx1*i;
x2+=dx2*i;
z1+=dz1*i;
z2+=dz2*i;
}
}
while (dy2++<=0) {
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
y--;
x1+=dx1;
x2+=dx2;
z1+=dz1;
z2+=dz2;
}
} else if ((dy2=p2->y-p1->y)>0) {
/*
p1x<= {p2x,p4x}
p1y<
p2y<=
p4y
1
6
1
6
1
2
4
1
2
4
1
2
4
*/
dy1=p4->y-p1->y;
dx1=(p4->x-p1->x)<<32/dy1;
dz1=(p4->z-p1->z)<<32/dy1;
dx2=(p2->x-p1->x)<<32/dy2;
dz2=(p2->z-p1->z)<<32/dy2;
x1=x2=p1->x<<32; y=p1->y; z1=z2=p1->z<<32;
if (y+dy2>=y_max) {
i=y+dy2-y_max+1;
if (i>dy2) goto ft_done;
dy2-=i;
}
if (y<y_min) {
i=y_min-y;
if (i>dy2)
i=dy2;
dy2-=i;
y+=i;
x1+=dx1*i;
x2+=dx2*i;
z1+=dz1*i;
z2+=dz2*i;
}
while (dy2--) {
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
y++;
x1+=dx1;
x2+=dx2;
z1+=dz1;
z2+=dz2;
}
if (dy2=p4->y-p2->y) {
dx2=(p4->x-p2->x)<<32/dy2;
dz2=(p4->z-p2->z)<<32/dy2;
if (y+dy2>=y_max) {
i=y+dy2-y_max+1;
while (dy2++) {
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y1,z1.i32[1],z2.i32[1]);
y1--;
x1+=dx1;
x2+=dx2;
z1+=dz1;
z2+=dz2;
}
if (dy2=p2->y-p4->y) {
dx2=(p4->x-p2->x)<<32/dy2;
dz2=(p4->z-p2->z)<<32/dy2;
if (y1+dy2<min) {
i=min-(y1+dy2);
if (i>-dy2) goto ft_done;
dy2+=i;
}
if (y1>=max) {
i=y1-max+1;
if (i>-dy2) goto ft_done;
dy2+=i;
y1-=i;
x1+=dx1*i;
x2+=dx2*i;
z1+=dz1*i;
z2+=dz2*i;
}
}
while (dy2++<=0) {
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y1,z1.i32[1],z2.i32[1]);
y1--;
x1+=dx1;
x2+=dx2;
z1+=dz1;
z2+=dz2;
}
} else if ((dy2=p2->y-p1->y)>0) {
dy1=p4->y-p1->y;
dx1=(p4->x-p1->x)<<32/dy1;
dz1=(p4->z-p1->z)<<32/dy1;
dx2=(p2->x-p1->x)<<32/dy2;
dz2=(p2->z-p1->z)<<32/dy2;
x1=x2=p1->x<<32; y1=p1->y; z1=z2=p1->z<<32;
if (y1+dy2>=max) {
i=y1+dy2-max+1;
if (i>dy2) goto ft_done;
dy2-=i;
}
if (y<y_min) {
i=y_min-y;
if (i>dy2) goto ft_done;
if (y1<min) {
i=min-y1;
if (i>dy2)
i=dy2;
dy2-=i;
y+=i;
y1+=i;
x1+=dx1*i;
x2+=dx2*i;
z1+=dz1*i;
z2+=dz2*i;
}
}
while (dy2-->=0) {
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
y++;
x1+=dx1;
x2+=dx2;
z1+=dz1;
z2+=dz2;
while (dy2--) {
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y1,z1.i32[1],z2.i32[1]);
y1++;
x1+=dx1;
x2+=dx2;
z1+=dz1;
z2+=dz2;
}
if (dy2=p4->y-p2->y) {
dx2=(p4->x-p2->x)<<32/dy2;
dz2=(p4->z-p2->z)<<32/dy2;
if (y1+dy2>=max) {
i=y1+dy2-max+1;
if (i>dy2) goto ft_done;
dy2-=i;
}
if (y1<min) {
i=min-y1;
if (i>dy2) goto ft_done;
dy2-=i;
y1+=i;
x1+=dx1*i;
x2+=dx2*i;
z1+=dz1*i;
z2+=dz2*i;
}
}
while (dy2-->=0) {
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y1,z1.i32[1],z2.i32[1]);
y1++;
x1+=dx1;
x2+=dx2;
z1+=dz1;
z2+=dz2;
}
} else {
if (dy1=p2->y-p1->y) {
dx1=(p2->x-p1->x)<<32/dy1;
dz1=(p2->z-p1->z)<<32/dy1;
if (dy2=p2->y-p4->y) {
dx2=(p2->x-p4->x)<<32/dy2;
dz2=(p2->z-p4->z)<<32/dy2;
} else {
dx2=0;
dz2=0;
}
x1=x2=p2->x<<32; y1=p2->y; z1=z2=p2->z<<32;
if (y1<min) {
i=min-y1;
if (i>-dy1)
i=-dy1;
dy1+=i;
y1+=i;
x1+=dx1*i;
x2+=dx2*i;
z1+=dz1*i;
z2+=dz2*i;
}
while (dy1++<=0) {
if (y1<max)
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y1,z1.i32[1],z2.i32[1]);
y1++;
x1+=dx1;
x2+=dx2;
z1+=dz1;
z2+=dz2;
}
}
if (dy1=p4->y-p1->y) {
dx1=(p1->x-p4->x)<<32/dy1;
dz1=(p1->z-p4->z)<<32/dy1;
if (dy2=p4->y-p2->y) {
dx2=(p2->x-p4->x)<<32/dy2;
dz2=(p2->z-p4->z)<<32/dy2;
} else {
dx2=0;
dz2=0;
}
x1=x2=p4->x<<32; y1=p4->y; z1=z2=p4->z<<32;
if (y1-dy1<min) {
i=min-(y1-dy1);
if (i>dy1) goto ft_done;
dy1-=i;
}
if (y1>=max) {
i=y1-max+1;
if (i>dy1) goto ft_done;
dy1-=i;
y1-=i;
x1+=dx1*i;
x2+=dx2*i;
z1+=dz1*i;
z2+=dz2*i;
}
while (dy1-->=0) {
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y1,z1.i32[1],z2.i32[1]);
y1--;
x1+=dx1;
x2+=dx2;
z1+=dz1;
z2+=dz2;
}
}
}
} else {
/*
p1x<= {p2x,p4x}
p2y<=
p1y<=
p4y
7
16
124
3
4
2
5
3
4
2
1
4
2
1
4
2
1
4
//p1 is min y
if (p4->y<p2->y)
SwapI64(&p4,&p2);
if (p2->y<p1->y)
SwapI64(&p2,&p1);
//p2x<=p4x
if (p4->x<p2->x)
SwapI64(&p4,&p2);
min=0;
max=dc->width;
if (dc->flags & DCF_SCREEN_BITMAP) {
win_task=dc->win_task;
min-=win_task->scroll_x+win_task->pix_left;
max-=win_task->scroll_x+win_task->pix_left;
if (max>win_task->pix_right-(win_task->scroll_x+win_task->pix_left))
max=win_task->pix_right-(win_task->scroll_x+win_task->pix_left);
}
2
1
4
*/
if (dy1=p2->y-p1->y) {
dx1=(p2->x-p1->x)<<32/dy1;
dz1=(p2->z-p1->z)<<32/dy1;
if (dy2=p2->y-p4->y) {
dx2=(p2->x-p4->x)<<32/dy2;
dz2=(p2->z-p4->z)<<32/dy2;
} else {
dx2=0;
dz2=0;
if ((dx2=p4->x-p1->x)<0) {
dx1=p2->x-p1->x;
dy1=(p1->y-p2->y)<<32/dx1;
dz1=(p1->z-p2->z)<<32/dx1;
dy2=(p1->y-p4->y)<<32/dx2;
dz2=(p1->z-p4->z)<<32/dx2;
y1=y2=p1->y<<32; x1=p1->x; z1=z2=p1->z<<32;
if (x1+dx2<min) {
i=min-(x1+dx2);
if (i>-dx2) goto ft_done;
dx2+=i;
}
x1=x2=p2->x<<32; y=p2->y; z1=z2=p2->z<<32;
if (y<y_min) {
i=y_min-y;
if (i>-dy1)
i=-dy1;
dy1+=i;
y+=i;
x1+=dx1*i;
x2+=dx2*i;
if (x1>=max) {
i=x1-max+1;
if (i>-dx2)
i=-dx2;
dx2+=i;
x1-=i;
y1+=dy1*i;
y2+=dy2*i;
z1+=dz1*i;
z2+=dz2*i;
}
while (dy1++<=0) {
if (y<y_max)
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
y++;
x1+=dx1;
x2+=dx2;
while (dx2++) {
res+=GrVLine(dc,x1,y1.i32[1],y2.i32[1],z1.i32[1],z2.i32[1]);
x1--;
y1+=dy1;
y2+=dy2;
z1+=dz1;
z2+=dz2;
}
}
if (dy1=p4->y-p1->y) {
dx1=(p1->x-p4->x)<<32/dy1;
dz1=(p1->z-p4->z)<<32/dy1;
if (dy2=p4->y-p2->y) {
dx2=(p2->x-p4->x)<<32/dy2;
dz2=(p2->z-p4->z)<<32/dy2;
} else {
dx2=0;
dz2=0;
if (dx2=p2->x-p4->x) {
dy2=(p4->y-p2->y)<<32/dx2;
dz2=(p4->z-p2->z)<<32/dx2;
if (x1+dx2<min) {
i=min-(x1+dx2);
if (i>-dx2) goto ft_done;
dx2+=i;
}
if (x1>=max) {
i=x1-max+1;
if (i>-dx2) goto ft_done;
dx2+=i;
x1-=i;
y1+=dy1*i;
y2+=dy2*i;
z1+=dz1*i;
z2+=dz2*i;
}
}
while (dx2++<=0) {
res+=GrVLine(dc,x1,y1.i32[1],y2.i32[1],z1.i32[1],z2.i32[1]);
x1--;
y1+=dy1;
y2+=dy2;
z1+=dz1;
z2+=dz2;
}
x1=x2=p4->x<<32; y=p4->y; z1=z2=p4->z<<32;
if (y-dy1<y_min) {
i=y_min-(y-dy1);
if (i>dy1) goto ft_done;
dy1-=i;
} else if ((dx2=p2->x-p1->x)>0) {
dx1=p4->x-p1->x;
dy1=(p4->y-p1->y)<<32/dx1;
dz1=(p4->z-p1->z)<<32/dx1;
dy2=(p2->y-p1->y)<<32/dx2;
dz2=(p2->z-p1->z)<<32/dx2;
y1=y2=p1->y<<32; x1=p1->x; z1=z2=p1->z<<32;
if (x1+dx2>=max) {
i=x1+dx2-max+1;
if (i>dx2) goto ft_done;
dx2-=i;
}
if (y>=y_max) {
i=y-y_max+1;
if (i>dy1) goto ft_done;
dy1-=i;
y-=i;
x1+=dx1*i;
x2+=dx2*i;
if (x1<min) {
i=min-x1;
if (i>dx2)
i=dx2;
dx2-=i;
x1+=i;
y1+=dy1*i;
y2+=dy2*i;
z1+=dz1*i;
z2+=dz2*i;
}
while (dy1-->=0) {
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
y--;
x1+=dx1;
x2+=dx2;
while (dx2--) {
res+=GrVLine(dc,x1,y1.i32[1],y2.i32[1],z1.i32[1],z2.i32[1]);
x1++;
y1+=dy1;
y2+=dy2;
z1+=dz1;
z2+=dz2;
}
if (dx2=p4->x-p2->x) {
dy2=(p4->y-p2->y)<<32/dx2;
dz2=(p4->z-p2->z)<<32/dx2;
if (x1+dx2>=max) {
i=x1+dx2-max+1;
if (i>dx2) goto ft_done;
dx2-=i;
}
if (x1<min) {
i=min-x1;
if (i>dx2) goto ft_done;
dx2-=i;
x1+=i;
y1+=dy1*i;
y2+=dy2*i;
z1+=dz1*i;
z2+=dz2*i;
}
}
while (dx2-->=0) {
res+=GrVLine(dc,x1,y1.i32[1],y2.i32[1],z1.i32[1],z2.i32[1]);
x1++;
y1+=dy1;
y2+=dy2;
z1+=dz1;
z2+=dz2;
}
} else {
if (dx1=p2->x-p1->x) {
dy1=(p2->y-p1->y)<<32/dx1;
dz1=(p2->z-p1->z)<<32/dx1;
if (dx2=p2->x-p4->x) {
dy2=(p2->y-p4->y)<<32/dx2;
dz2=(p2->z-p4->z)<<32/dx2;
} else {
dy2=0;
dz2=0;
}
y1=y2=p2->y<<32; x1=p2->x; z1=z2=p2->z<<32;
if (x1<min) {
i=min-x1;
if (i>-dx1)
i=-dx1;
dx1+=i;
x1+=i;
y1+=dy1*i;
y2+=dy2*i;
z1+=dz1*i;
z2+=dz2*i;
}
while (dx1++<=0) {
if (x1<max)
res+=GrVLine(dc,x1,y1.i32[1],y2.i32[1],z1.i32[1],z2.i32[1]);
x1++;
y1+=dy1;
y2+=dy2;
z1+=dz1;
z2+=dz2;
}
}
if (dx1=p4->x-p1->x) {
dy1=(p1->y-p4->y)<<32/dx1;
dz1=(p1->z-p4->z)<<32/dx1;
if (dx2=p4->x-p2->x) {
dy2=(p2->y-p4->y)<<32/dx2;
dz2=(p2->z-p4->z)<<32/dx2;
} else {
dy2=0;
dz2=0;
}
y1=y2=p4->y<<32; x1=p4->x; z1=z2=p4->z<<32;
if (x1-dx1<min) {
i=min-(x1-dx1);
if (i>dx1) goto ft_done;
dx1-=i;
}
if (x1>=max) {
i=x1-max+1;
if (i>dx1) goto ft_done;
dx1-=i;
x1-=i;
y1+=dy1*i;
y2+=dy2*i;
z1+=dz1*i;
z2+=dz2*i;
}
while (dx1-->=0) {
res+=GrVLine(dc,x1,y1.i32[1],y2.i32[1],z1.i32[1],z2.i32[1]);
x1--;
y1+=dy1;
y2+=dy2;
z1+=dz1;
z2+=dz2;
}
}
}
}
ft_done:

1
Adam/Opt/Boot/BootDVD.CPP

@ -1,4 +1,3 @@
#define DVD_BOOT_LOADER_SIZE DVD_BLK_SIZE*1 //Max DVD_BLK_SIZE*4, I think
#define BOOT_HIGH_LOC_DVD ((BOOT_RAM_LIMIT-\
(BOOT_STK_SIZE+DVD_BOOT_LOADER_SIZE))>>4)

33
Adam/Opt/Boot/BootDVDIns.CPP

@ -0,0 +1,33 @@
//See $LK,"Install Documentation",A="FI:::/Doc/Install.TXT"$ or $LK,"Upgrading Documentation",A="FI:::/Doc/Upgrade.TXT"$.
//Study my account examples: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOSCfg.CPP,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOSDistro.CPP,1"$
#include "BootDVD"
#include "DskISORedSea"
#include "DskISO9660"
#help_index "Install"
#define KERNEL_BIN_C "Kernel.BIN.C"
#define BOOT_DIR "/0000Boot"
#define BOOT_DIR_KERNEL_BIN_C BOOT_DIR "/0000" KERNEL_BIN_C
U0 MakeAll()
{
if (Cmp("/Compiler/Compiler","Compiler",,':'))
throw;
if (Cmp("/Kernel/Kernel","Kernel",,':'))
throw;
}
public U0 BootDVDIns(U8 drv_let=0)
{//See $LK,"::/Misc/DoDistro.CPP"$.
try {
if (!Drv(drv_let))
throw;
MakeAll;
Move("/Kernel/Kernel.BIN.Z",BOOT_DIR_KERNEL_BIN_C);
} catch {
PutExcept;
Beep;
}
}

4
Adam/Opt/Boot/BootHD.CPP

@ -48,12 +48,12 @@ BHD_GET_IP:
BHD_BIOS_DRV_NUM: DU8 0;
//Gets patched by $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$().
//Gets patched by $LK,"BootHDIns",A="MN:BootHDIns"$().
BHD_BLK_CNT:: DU16 0;
BHD_DAP: DU8 16,0,1,0; //One blk at a time
BHD_DAP_BUF: DU16 0,0;
//Gets patched by $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$().
//Gets patched by $LK,"BootHDIns",A="MN:BootHDIns"$().
BHD_DAP_BLK:: //64-bit
BHD_DAP_BLK_LO: DU32 0;
BHD_DAP_BLK_HI: DU32 0;

60
Adam/Opt/Boot/BootHDIns.CPP

@ -0,0 +1,60 @@
//See $LK,"Install Documentation",A="FI:::/Doc/Install.TXT"$ or $LK,"Upgrading Documentation",A="FI:::/Doc/Upgrade.TXT"$.
//Study my account examples: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOSCfg.CPP,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOSDistro.CPP,1"$
#include "BootHD"
#help_index "Install"
#define KERNEL_BIN_C "Kernel.BIN.C"
U0 MakeAll()
{
if (Cmp("/Compiler/Compiler","Compiler",,':'))
throw;
if (Cmp("/Kernel/Kernel","Kernel",,':'))
throw;
}
public U0 BootHDIns(U8 drv_let=0)
{//$LK,"MakeAll",A="MN:MakeAll"$ and install new boot-loader.
CDrv *dv;
CFAT32Boot br;
CDirEntry de;
I64 i;
try {
if (!Drv(drv_let))
throw;
dv=Fs->cur_dv;
MakeAll;
switch (Let2BlkDevType(dv->drv_let)) {
case BDT_RAM:
case BDT_ATA:
Move("/Kernel/Kernel.BIN.Z","/" KERNEL_BIN_C);
if (!FileFind("/" KERNEL_BIN_C,&de,FUF_JUST_FILES))
"No Kernel.BIN.C\n";
else {
Free(de.full_name);
"Modifying partition boot record.\n";
RBlks(dv,&br,dv->drv_offset,1);
br.jump_and_nop[0]=OC_JMP_REL8;
br.jump_and_nop[1]=offset(CFAT32Boot.code)-2;
#assert offset(CFAT32Boot.code)>=offset(CRedSeaBoot.code)
br.jump_and_nop[2]=OC_NOP;
*BHD_BLK_CNT(U16 *)=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
*BHD_DAP_BLK(I64 *)=Cluster2Blk(dv,de.cluster);
for (i=0;i<BHD_END-BHD_CODE;i++)
br.code[i]=BHD_CODE(U8 *)[i];
#assert sizeof(CFAT32Boot.code)>=BHD_END-BHD_CODE
for (;i<sizeof(CFAT32Boot.code);i++)
br.code[i]=0;
WBlks(dv,&br,dv->drv_offset,1);
}
break;
default:
throw;
}
} catch {
PutExcept;
Beep;
}
}

4
Adam/Opt/Boot/BootMHD.CPP

@ -61,12 +61,12 @@ BMHD_GET_IP:
BMHD_BIOS_DRV_NUM: DU8 0;
BMHD_OLD_CS_IP: DU16 0,0;
//Gets patched by $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$().
//Gets patched by $LK,"BootHDIns",A="MN:BootHDIns"$().
BMHD_BLK_CNT:: DU16 0;
BMHD_DAP: DU8 16,0,1,0; //One blk at a time
BMHD_DAP_BUF: DU16 0,0;
//Gets patched by $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$().
//Gets patched by $LK,"BootHDIns",A="MN:BootHDIns"$().
BMHD_DAP_BLK:: //64-bit
BMHD_DAP_BLK_LO: DU32 0;
BMHD_DAP_BLK_HI: DU32 0;

99
Adam/Opt/Boot/BootIns.CPP → Adam/Opt/Boot/BootMHDIns.CPP

@ -1,98 +1,18 @@
//See $LK,"Install Documentation",A="FI:::/Doc/Install.TXT"$ or $LK,"Upgrading Documentation",A="FI:::/Doc/Upgrade.TXT"$.
//Study my account examples: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOSCfg.CPP,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOSDistro.CPP,1"$
#include "BootMHD"
#include "BootMHD2"
#help_index "Install"
#define KERNEL_BIN_C "Kernel.BIN.C"
#define BOOT_DIR "/0000Boot"
#define BOOT_DIR_KERNEL_BIN_C BOOT_DIR "/0000" KERNEL_BIN_C
//Stage 2 of master boot loader
#define BOOT_DIR_BOOTMHD2_BIN_C BOOT_DIR "/BootMHD2.BIN.C"
//Old master boot record
#define BOOT_DIR_OLDMBR_BIN_C BOOT_DIR "/OldMBR.BIN.C"
public U0 MakeAll()
{//Use $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$. Loader must be patched.
//These 2 modules (and bootloaders at top) are the only AOT
//compiled code in TempleOS. Everything else is JIT.
//You are doing it wrong if you make AOT compiled code.
if (Cmp("/Compiler/Compiler","Compiler",,':'))
throw;
if (Cmp("/Kernel/Kernel","Kernel",,':'))
throw;
}
public Bool MakeOSDrvBootInstall(U8 src_drv=0,U8 dst_drv=0)
{// Does $LK,"MakeAll",A="MN:MakeAll"$and installs new boot-loader.
//Normally, you just supply a src_drv. It will compile
//the code on that drive and update the boot sect.
//If you are making a bootable CD/DVD, you supply a dst_drv.
//See $LK,"::/Misc/DoDistro.CPP"$
//See $LK,"Install Documentation",A="FI:::/Doc/Install.TXT"$
//Study my account examples my technique: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOSCfg.CPP,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOSDistro.CPP,1"$
CBlkDev *bd;
CDrv *dv;
CFAT32Boot br;
CDirEntry de;
Bool res=FALSE;
I64 i,type;
try {
if (!src_drv) src_drv=Drv2Let(Fs->cur_dv);
src_drv=ToUpper(src_drv);
if (!dst_drv) dst_drv=src_drv;
dst_drv=ToUpper(dst_drv);
if (!Drv(src_drv))
throw;
MakeAll;
if ((dv=Let2Drv(dst_drv,FALSE)) && (bd=dv->bd))
type=bd->type;
else {
type=BDT_ATAPI;
PrintWarn("Defaulting to CD/DVD dst.\n");
}
switch (type) {
case BDT_ATAPI:
case BDT_FILE:
Move("/Kernel/Kernel.BIN.Z",BOOT_DIR_KERNEL_BIN_C);
res=TRUE;
break;
case BDT_RAM:
case BDT_ATA:
Move("/Kernel/Kernel.BIN.Z","/" KERNEL_BIN_C);
if (!FileFind("/" KERNEL_BIN_C,&de,FUF_JUST_FILES))
"No Kernel.BIN.C\n";
else {
Free(de.full_name);
"Modifying partition boot record.\n";
RBlks(dv,&br,dv->drv_offset,1);
br.jump_and_nop[0]=OC_JMP_REL8;
br.jump_and_nop[1]=offset(CFAT32Boot.code)-2;
#assert offset(CFAT32Boot.code)>=offset(CRedSeaBoot.code)
br.jump_and_nop[2]=OC_NOP;
*BHD_BLK_CNT(U16 *)=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;