mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2025-06-07 00:04:48 +00:00
chg -> change, exts -> externs, dsk -> disk, drv -> drive
This commit is contained in:
parent
9ab18d7cb1
commit
c5fbacdcce
Binary file not shown.
@ -376,7 +376,7 @@ U0 Psalmody(U8 *dirname="~/Psalmody")
|
||||
MenuPush(
|
||||
"File {"
|
||||
" New(,'.');"
|
||||
" ChgDir(MESSAGE_CMD,PSMF_CD);"
|
||||
" ChangeDir(MESSAGE_CMD,PSMF_CD);"
|
||||
" Open(,CH_CTRLO);"
|
||||
" SaveAs(,CH_CTRLA);"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
|
@ -157,7 +157,7 @@ U0 UnitDirectFire(Unit *tmpu,Unit *target)
|
||||
if (target_hit) {
|
||||
r=target->row;c=target->col;
|
||||
if ((facing=HexMoveOne(&r,&c,x1,y1))>=0)
|
||||
facing=FacingChg(facing,target->facing);
|
||||
facing=FacingChange(facing,target->facing);
|
||||
else
|
||||
facing=0;
|
||||
DamageDo(target,HitDamage(tmpu,target,facing,range_factor));
|
||||
|
@ -26,7 +26,7 @@ U0 Toward(I64 *_row,I64 *_col,I64 direction)
|
||||
}
|
||||
}
|
||||
|
||||
I64 FacingChg(I64 f1,I64 f2)
|
||||
I64 FacingChange(I64 f1,I64 f2)
|
||||
{
|
||||
I64 res=(f1+6-f2)%6;
|
||||
if (res>=3)
|
||||
|
@ -9,7 +9,7 @@ I64 HexMoveOneCost(Unit *tmpu,I64 r,I64 c,I64 facing)
|
||||
if (tmpu->infantry)
|
||||
res=0;
|
||||
else {
|
||||
res=FacingChg(facing,tmpu->facing);
|
||||
res=FacingChange(facing,tmpu->facing);
|
||||
if (res>0) res--;
|
||||
}
|
||||
if (roads[r][c] && roads[tmpu->row][tmpu->col])
|
||||
|
@ -901,7 +901,7 @@ U0 ParseBinFile(CCompCtrl *cc)
|
||||
Lex(cc);
|
||||
}
|
||||
|
||||
U0 ParseAsmBlk(CCompCtrl *cc,I64 cmp_flags)
|
||||
U0 ParseAsmBlk(CCompCtrl *cc,I64 comp_flags)
|
||||
{
|
||||
CAOTCtrl *aotc=cc->aotc;
|
||||
I64 i,j,k,argcount,
|
||||
@ -913,7 +913,7 @@ U0 ParseAsmBlk(CCompCtrl *cc,I64 cmp_flags)
|
||||
|
||||
aotc->seg_size=64;
|
||||
cc->flags|=CCF_ASM_EXPRESSIONS;
|
||||
if (!(cmp_flags&CMPF_ONE_ASM_INS)) {
|
||||
if (!(comp_flags&CMPF_ONE_ASM_INS)) {
|
||||
if (cc->token!='{')
|
||||
LexExcept(cc,"Expecting '{' at ");
|
||||
Lex(cc);
|
||||
@ -1103,7 +1103,7 @@ U0 ParseAsmBlk(CCompCtrl *cc,I64 cmp_flags)
|
||||
Lex(cc);
|
||||
else
|
||||
LexExcept(cc,"Syntax error at ");
|
||||
if (cmp_flags&CMPF_ONE_ASM_INS && (cc->token!=TK_IDENT ||
|
||||
if (comp_flags&CMPF_ONE_ASM_INS && (cc->token!=TK_IDENT ||
|
||||
!(tmpo=cc->hash_entry) ||
|
||||
!(tmpo->type&(HTT_OPCODE|HTT_ASM_KEYWORD))))
|
||||
break;
|
||||
|
@ -92,25 +92,25 @@ U0 ICCopyTemplate(CCompCtrl *cc,CIntermediateCode *tmpi,I64 op,
|
||||
alt=FALSE;
|
||||
}
|
||||
if (alt && dont_push_float && !dont_pop_float) {
|
||||
ptr=cmp_templates_dont_push2[op];
|
||||
i=cmp_templates_dont_push2[op+1]-ptr;
|
||||
ptr=comp_templates_dont_push2[op];
|
||||
i=comp_templates_dont_push2[op+1]-ptr;
|
||||
}
|
||||
if (!i) {
|
||||
if (dont_push_float) {
|
||||
if (dont_pop_float) {
|
||||
ptr=cmp_templates_dont_push_pop[op];
|
||||
i=cmp_templates_dont_push_pop[op+1]-ptr;
|
||||
ptr=comp_templates_dont_push_pop[op];
|
||||
i=comp_templates_dont_push_pop[op+1]-ptr;
|
||||
} else {
|
||||
ptr=cmp_templates_dont_push[op];
|
||||
i=cmp_templates_dont_push[op+1]-ptr;
|
||||
ptr=comp_templates_dont_push[op];
|
||||
i=comp_templates_dont_push[op+1]-ptr;
|
||||
}
|
||||
} else {
|
||||
if (dont_pop_float) {
|
||||
ptr=cmp_templates_dont_pop[op];
|
||||
i=cmp_templates_dont_pop[op+1]-ptr;
|
||||
ptr=comp_templates_dont_pop[op];
|
||||
i=comp_templates_dont_pop[op+1]-ptr;
|
||||
} else {
|
||||
ptr=cmp_templates[op];
|
||||
i=cmp_templates[op+1]-ptr;
|
||||
ptr=comp_templates[op];
|
||||
i=comp_templates[op+1]-ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -567,7 +567,7 @@ U0 ICFModEqu(CCompCtrl *cc,CIntermediateCode *tmpi,I64 rip)
|
||||
ICFCvt2(cc,tmpi,REG_RDX,MDF_REG+RT_I64,REG_RDX,0,FALSE,rip);
|
||||
}
|
||||
//TODO: unpushable,unpop? Not sure
|
||||
ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_MOD,FALSE,FALSE,FALSE,CN_INST);
|
||||
ICCopyTemplate(cc,tmpi,CMP_TEMPLATE_MOD,FALSE,FALSE,FALSE,CN_INST);
|
||||
if (tmpi->arg1_type_pointed_to!=RT_F64)
|
||||
ICFCvt2(cc,tmpi,REG_RAX,MDF_REG+RT_I64,REG_RAX,0,TRUE,rip);
|
||||
ICMov(tmpi,tmpi->arg1.type&MDG_MASK+tmpi->arg1_type_pointed_to,
|
||||
|
@ -27,7 +27,7 @@ extern CHashFun *ParseFunJoin(
|
||||
CCompCtrl *cc,CHashClass *tmp_return,U8 *name,I64 fsp_flags);
|
||||
extern I64 ParseKeyWord(CCompCtrl *cc);
|
||||
extern Bool ParseStatement(CCompCtrl *cc,I64 try_count=0,
|
||||
CCodeMisc *lb_break=NULL,I64 cmp_flags=CMPF_PRS_SEMICOLON);
|
||||
CCodeMisc *lb_break=NULL,I64 comp_flags=CMPF_PRS_SEMICOLON);
|
||||
extern U0 ParseStreamBlk(CCompCtrl *cc);
|
||||
extern CHashClass *ParseType(CCompCtrl *cc,CHashClass **_tmpc1,
|
||||
I64 *_mode,CMemberList *tmpm,U8 **_ident,CHashFun **_fun_ptr,
|
||||
@ -39,8 +39,8 @@ extern I64 ParseUnaryTerm(
|
||||
I64 *max_prec,I64 *unary_pre_prec,I64 *paren_prec);
|
||||
extern U0 ParseVarInit2(CCompCtrl *cc,U8 **_dst,CHashClass *tmpc,
|
||||
CArrayDim *tmpad,U8 *data_addr_rip,U8 **_base,Bool data_heap,I64 pass);
|
||||
_extern CMP_TEMPLATES U32 cmp_templates[1];
|
||||
_extern CMP_TEMPLATES_DONT_POP U32 cmp_templates_dont_pop[1];
|
||||
_extern CMP_TEMPLATES_DONT_PUSH2 U32 cmp_templates_dont_push2[1];
|
||||
_extern CMP_TEMPLATES_DONT_PUSH U32 cmp_templates_dont_push[1];
|
||||
_extern CMP_TEMPLATES_DONT_PUSH_POP U32 cmp_templates_dont_push_pop[1];
|
||||
_extern CMP_TEMPLATES U32 comp_templates[1];
|
||||
_extern CMP_TEMPLATES_DONT_POP U32 comp_templates_dont_pop[1];
|
||||
_extern CMP_TEMPLATES_DONT_PUSH2 U32 comp_templates_dont_push2[1];
|
||||
_extern CMP_TEMPLATES_DONT_PUSH U32 comp_templates_dont_push[1];
|
||||
_extern CMP_TEMPLATES_DONT_PUSH_POP U32 comp_templates_dont_push_pop[1];
|
@ -1,4 +1,4 @@
|
||||
U8 *LexStatement2Bin(CCompCtrl *cc,I64 *_type,I64 cmp_flags=0)
|
||||
U8 *LexStatement2Bin(CCompCtrl *cc,I64 *_type,I64 comp_flags=0)
|
||||
{//Compile one cc stmt to bin code.
|
||||
I64 size,i,j,k,*res=INVALID_PTR;
|
||||
CCodeCtrl *tmpcbh;
|
||||
@ -7,7 +7,7 @@ U8 *LexStatement2Bin(CCompCtrl *cc,I64 *_type,I64 cmp_flags=0)
|
||||
if (cc->aot_depth==2)
|
||||
COCPush(cc);
|
||||
COCInit(cc);
|
||||
if (!ParseStatement(cc,,,cmp_flags)) {
|
||||
if (!ParseStatement(cc,,,comp_flags)) {
|
||||
if (cc->coc.coc_head.next!=&cc->coc.coc_head) {
|
||||
cc->coc.coc_head.last->ic_flags&=~ICF_RES_NOT_USED;
|
||||
ICAdd(cc,IC_RETURN_VAL2,0,0);
|
||||
@ -32,7 +32,7 @@ U8 *LexStatement2Bin(CCompCtrl *cc,I64 *_type,I64 cmp_flags=0)
|
||||
return res;
|
||||
}
|
||||
|
||||
CAOT *CompJoin(CCompCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=0)
|
||||
CAOT *CompJoin(CCompCtrl *cc,I64 comp_flags,U8 *map_name=NULL,U8 mapfile_drive_let=0)
|
||||
{
|
||||
CAOTCtrl *aotc,*old_aot=cc->aotc;
|
||||
I64 i,j,l;
|
||||
@ -75,27 +75,27 @@ CAOT *CompJoin(CCompCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=
|
||||
cc->htc.local_var_list=cc->htc.fun; //HolyC local vars
|
||||
cc->htc.fun=NULL;
|
||||
try {
|
||||
if (cmp_flags&CMPF_LEX_FIRST)
|
||||
if (comp_flags&CMPF_LEX_FIRST)
|
||||
Lex(cc);
|
||||
if (!(cmp_flags&CMPF_ONE_ASM_INS))
|
||||
cmp_flags|=CMPF_PRS_SEMICOLON;
|
||||
if (!(comp_flags&CMPF_ONE_ASM_INS))
|
||||
comp_flags|=CMPF_PRS_SEMICOLON;
|
||||
if (cc->flags&CCF_AOT_COMPILE) {
|
||||
while (cc->token!=TK_EOF) {
|
||||
buf=LexStatement2Bin(cc,NULL,cmp_flags);
|
||||
buf=LexStatement2Bin(cc,NULL,comp_flags);
|
||||
if (buf!=INVALID_PTR) {
|
||||
tmpie=CAlloc(sizeof(CAOTImportExport));
|
||||
tmpie->type=IET_MAIN;
|
||||
tmpie->rip=buf;
|
||||
QueueInsert(tmpie,res->last_ie);
|
||||
}
|
||||
if (cmp_flags&CMPF_ASM_BLK)
|
||||
if (comp_flags&CMPF_ASM_BLK)
|
||||
break;
|
||||
}
|
||||
} else
|
||||
ParseStatement(cc,,,cmp_flags);
|
||||
ParseStatement(cc,,,comp_flags);
|
||||
AOTGlobalsResolve(cc,res);
|
||||
} catch {
|
||||
if (Fs->except_ch=='Compiler' && !(cmp_flags&CMPF_ASM_BLK)) {
|
||||
if (Fs->except_ch=='Compiler' && !(comp_flags&CMPF_ASM_BLK)) {
|
||||
LexPutPos(cc);
|
||||
Fs->catch_except=TRUE;
|
||||
}
|
||||
@ -110,7 +110,7 @@ CAOT *CompJoin(CCompCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=
|
||||
res=NULL;
|
||||
} else {
|
||||
if (map_name)
|
||||
MapFileWrite(cc->htc.glbl_hash_table,map_name,mapfile_drv_let);
|
||||
MapFileWrite(cc->htc.glbl_hash_table,map_name,mapfile_drive_let);
|
||||
HashTableDel(cc->htc.local_hash_table);
|
||||
HashTableDel(cc->htc.glbl_hash_table);
|
||||
|
||||
@ -155,14 +155,14 @@ CAOT *CompJoin(CCompCtrl *cc,I64 cmp_flags,U8 *map_name=NULL,U8 mapfile_drv_let=
|
||||
}
|
||||
|
||||
CAOT *CompBuf(U8 *buf,U8 *map_name=NULL,
|
||||
I64 *error_count=NULL, I64 *warning_count=NULL,U8 mapfile_drv_let=0)
|
||||
I64 *error_count=NULL, I64 *warning_count=NULL,U8 mapfile_drive_let=0)
|
||||
{
|
||||
CCompCtrl *cc;
|
||||
CAOT *res=NULL;
|
||||
cc=CompCtrlNew(buf,CCF_DONT_FREE_BUF);
|
||||
cc->flags|=CCF_AOT_COMPILE;
|
||||
QueueInsert(cc,Fs->last_cc);
|
||||
res=CompJoin(cc,CMPF_LEX_FIRST,map_name,mapfile_drv_let);
|
||||
res=CompJoin(cc,CMPF_LEX_FIRST,map_name,mapfile_drive_let);
|
||||
if (error_count) *error_count=cc->error_count;
|
||||
if (warning_count) *warning_count=cc->warning_count;
|
||||
QueueRemove(cc);
|
||||
@ -416,7 +416,7 @@ U0 CompFixUpAOTAsm(CCompCtrl *cc,CAOT *tmpaot)
|
||||
}
|
||||
}
|
||||
|
||||
I64 Comp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
|
||||
I64 Comp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drive_let=0)
|
||||
{//AOT Compile HC or PRJ file a and output BIN file. Returns err_count.
|
||||
U8 *ptr,*fbuf=NULL,*fbuf2=NULL,*fbuf3=NULL,
|
||||
*patch_table=MAlloc(0x20000);
|
||||
@ -433,7 +433,7 @@ I64 Comp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
|
||||
if (map_name)
|
||||
fbuf3=ExtDefault(map_name,"MAP");
|
||||
|
||||
if (tmpaot=CompBuf(fbuf2,fbuf3,&error_count,&warning_count,mapfile_drv_let)) {
|
||||
if (tmpaot=CompBuf(fbuf2,fbuf3,&error_count,&warning_count,mapfile_drive_let)) {
|
||||
aot_U8s=tmpaot->aot_U8s;
|
||||
ptr=patch_table;
|
||||
//See $LK,"Load",A="MN:Load"$()
|
||||
@ -552,7 +552,7 @@ I64 Comp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
|
||||
if (out_name)
|
||||
fbuf2=ExtDefault(out_name,"BIN");
|
||||
else
|
||||
fbuf2=ExtChg(fbuf,"BIN");
|
||||
fbuf2=ExtChange(fbuf,"BIN");
|
||||
FileWrite(fbuf2,bfh,size);
|
||||
Free(bfh);
|
||||
Free(tmpaot->buf);
|
||||
|
Binary file not shown.
@ -20,6 +20,7 @@ $LK,"ICQueueIns",A="FL:::/Compiler/BackC.HC,354",BI=17$
|
||||
$LK,"ICAndBranch",A="FL:::/Compiler/BackC.HC,1",BI=18$
|
||||
$LK,"ParseAsmInst",A="FL:::/Compiler/Asm.HC,395",BI=19$
|
||||
$LK,"U",A="FL:::/Compiler/UAsm.HC,653",BI=20$
|
||||
$LK,"comp_templates_dont_push",A="FL:::/Compiler/CExterns.HC,45"$
|
||||
$LK,"LastFun",A="FL:::/Compiler/CMisc.HC,48"$
|
||||
$LK,"OptLead1",A="FL:::/Compiler/OptLib.HC,73",BI=21$
|
||||
$LK,"ExePutS2",A="FL:::/Compiler/CMain.HC,631",BI=22$
|
||||
@ -77,6 +78,7 @@ $LK,"CN_INST",A="FL:::/Compiler/BackFA.HC,3"$
|
||||
$LK,"CmdLinePrompt",A="FL:::/Compiler/CMisc.HC,127",BI=57$
|
||||
$LK,"ParseClassNew",A="FL:::/Compiler/ParseLib.HC,40",BI=58$
|
||||
$LK,"OptPass3",A="FL:::/Compiler/OptPass3.HC,1",BI=59$
|
||||
$LK,"comp_templates_dont_push2",A="FL:::/Compiler/CExterns.HC,44"$
|
||||
$LK,"OptPass4",A="FL:::/Compiler/OptPass4.HC,133",BI=60$
|
||||
$LK,"OptPass5",A="FL:::/Compiler/OptPass5.HC,1",BI=61$
|
||||
$LK,"OptPass6",A="FL:::/Compiler/OptPass6.HC,96",BI=62$
|
||||
@ -178,6 +180,7 @@ $LK,"OptLag2",A="FL:::/Compiler/OptLib.HC,62",BI=138$
|
||||
$LK,"StreamPrint",A="FL:::/Compiler/CMisc.HC,68",BI=139$
|
||||
$LK,"_LAST_FUN",A="FL:::/Compiler/CMisc.HC,12"$
|
||||
$LK,"ICFCvt",A="FL:::/Compiler/BackFA.HC,123",BI=140$
|
||||
$LK,"comp_templates_dont_pop",A="FL:::/Compiler/CExterns.HC,43"$
|
||||
$LK,"StreamDir",A="FL:::/Compiler/CMisc.HC,82",BI=141$
|
||||
$LK,"GetOption",A="FL:::/Compiler/CMisc.HC,6",BI=142$
|
||||
$LK,"LexStatement2Bin",A="FL:::/Compiler/CMain.HC,1",BI=143$
|
||||
@ -236,9 +239,9 @@ $LK,"PE_DO_BINARY_OP",A="FL:::/Compiler/ParseExp.HC,9"$
|
||||
$LK,"OptLabelFwd",A="FL:::/Compiler/OptLib.HC,1",BI=184$
|
||||
$LK,"ICOrOr",A="FL:::/Compiler/BackB.HC,51",BI=185$
|
||||
$LK,"LexExcept",A="FL:::/Compiler/CExcept.HC,81",BI=186$
|
||||
$LK,"cmp_templates",A="FL:::/Compiler/CExts.HC,42"$
|
||||
$LK,"INTERNAL_TYPES_NUM",A="FL:::/Compiler/CInit.HC,1"$
|
||||
$LK,"CompF2PushPop",A="FL:::/Compiler/OptLib.HC,542",BI=187$
|
||||
$LK,"comp_templates",A="FL:::/Compiler/CExterns.HC,42"$
|
||||
$LK,"CompFixUpAOTAsm",A="FL:::/Compiler/CMain.HC,302",BI=188$
|
||||
$LK,"CMP_TEMPLATES",A="FL:::/Compiler/Templates.HC,4"$
|
||||
$LK,"MODR_D8_INDIRECT_REG",A="FL:::/Compiler/BackLib.HC,128"$
|
||||
@ -281,7 +284,6 @@ $LK,"CompJoin",A="FL:::/Compiler/CMain.HC,35",BI=219$
|
||||
$LK,"LexIncludeStr",A="FL:::/Compiler/Lex.HC,293",BI=220$
|
||||
$LK,"MODR_SIB_D8_INDIRECT_REG",A="FL:::/Compiler/BackLib.HC,131"$
|
||||
$LK,"CompCtrlNew",A="FL:::/Compiler/Lex.HC,28",BI=221$
|
||||
$LK,"cmp_type_flags_src_code",A="FL:::/Compiler/Lex.HC,322"$
|
||||
$LK,"ParseFor",A="FL:::/Compiler/ParseStatement.HC,529",BI=222$
|
||||
$LK,"MemberListDel",A="FL:::/Compiler/LexLib.HC,183",BI=223$
|
||||
$LK,"ParseFun",A="FL:::/Compiler/ParseStatement.HC,140",BI=224$
|
||||
@ -324,21 +326,19 @@ $LK,"SLASH_OP_IMM_U8",A="FL:::/Compiler/BackLib.HC,262"$
|
||||
$LK,"ExeFile",A="FL:::/Compiler/CMain.HC,614",BI=252$
|
||||
$LK,"COCMiscNew",A="FL:::/Compiler/ParseLib.HC,143",BI=253$
|
||||
$LK,"ParseVarList",A="FL:::/Compiler/ParseVar.HC,408",BI=254$
|
||||
$LK,"cmp_templates_dont_pop",A="FL:::/Compiler/CExts.HC,43"$
|
||||
$LK,"StreamExePrint",A="FL:::/Compiler/CMain.HC,673",BI=255$
|
||||
$LK,"COCGoToLabelFind",A="FL:::/Compiler/ParseLib.HC,152",BI=256$
|
||||
$LK,"CompOffset2Reg",A="FL:::/Compiler/OptLib.HC,83",BI=257$
|
||||
$LK,"comp_type_flags_src_code",A="FL:::/Compiler/Lex.HC,322"$
|
||||
$LK,"OptMVCompare",A="FL:::/Compiler/OptLib.HC,562",BI=258$
|
||||
$LK,"ICToBool",A="FL:::/Compiler/BackB.HC,289",BI=259$
|
||||
$LK,"ParseAsmBlk",A="FL:::/Compiler/Asm.HC,904",BI=260$
|
||||
$LK,"ParseAsmArg",A="FL:::/Compiler/Asm.HC,35",BI=261$
|
||||
$LK,"OptFixSizeOf",A="FL:::/Compiler/OptLib.HC,484",BI=262$
|
||||
$LK,"cmp_templates_dont_push",A="FL:::/Compiler/CExts.HC,45"$
|
||||
$LK,"cmp_templates_dont_push_pop",A="FL:::/Compiler/CExts.HC,46"$
|
||||
$LK,"comp_templates_dont_push_pop",A="FL:::/Compiler/CExterns.HC,46"$
|
||||
$LK,"ParseAsmImm",A="FL:::/Compiler/Asm.HC,1",BI=263$
|
||||
$LK,"LexAttachDoc",A="FL:::/Compiler/Lex.HC,325",BI=264$
|
||||
$LK,"MODR_RIP_REL_IMM_U32",A="FL:::/Compiler/BackLib.HC,134"$
|
||||
$LK,"cmp_templates_dont_push2",A="FL:::/Compiler/CExts.HC,44"$
|
||||
$LK,"InstEntryFind",A="FL:::/Compiler/UAsm.HC,66",BI=265$
|
||||
$LK,"ParseDoWhile",A="FL:::/Compiler/ParseStatement.HC,506",BI=266$
|
||||
$LK,"ParseStreamBlk",A="FL:::/Compiler/ParseStatement.HC,805",BI=267$
|
||||
|
@ -12,7 +12,7 @@
|
||||
#exe {Option(OPTf_EXTERNS_TO_IMPORTS,OFF);};
|
||||
#exe {Option(OPTf_KEEP_PRIVATE,OFF);};
|
||||
#include "Templates"
|
||||
#include "CExts"
|
||||
#include "CExterns"
|
||||
CCompGlobals cmp;
|
||||
#include "CInit"
|
||||
#include "CExcept"
|
||||
|
@ -51,7 +51,7 @@ public extern U0 LexPutPos(CCompCtrl *cc);
|
||||
public extern U0 LexPutToken(CCompCtrl *cc);
|
||||
public extern U0 LexSkipEol(CCompCtrl *cc);
|
||||
public extern U8 *LexStatement2Bin(
|
||||
CCompCtrl *cc,I64 *_type,I64 cmp_flags=CMPF_PRS_SEMICOLON);
|
||||
CCompCtrl *cc,I64 *_type,I64 comp_flags=CMPF_PRS_SEMICOLON);
|
||||
public extern U0 LexWarn(CCompCtrl *cc,U8 *str=NULL);
|
||||
extern CMemberList *MemberClassBaseFind(
|
||||
CHashClass *needle_class,CHashClass *haystack_class);
|
||||
@ -64,7 +64,7 @@ public extern I64 ParseKeyWord(CCompCtrl *cc);
|
||||
|
||||
#help_index "Compiler;Cmd Line (Typically)"
|
||||
extern I64 Comp(U8 *filename,
|
||||
U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0);
|
||||
U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drive_let=0);
|
||||
|
||||
#help_index "Debugging/Unassemble"
|
||||
public extern U8 *U(U8 *rip,I64 count=20,I64 seg_size=64);
|
||||
|
@ -319,7 +319,7 @@ CDoc *LexDocRead(U8 *abs_filename,I64 flags)
|
||||
return doc;
|
||||
}
|
||||
|
||||
I64 cmp_type_flags_src_code[(DOCT_TYPES_NUM+63)/64]={
|
||||
I64 comp_type_flags_src_code[(DOCT_TYPES_NUM+63)/64]={
|
||||
1<<DOCT_TEXT|1<<DOCT_TAB|1<<DOCT_INS_BIN|1<<DOCT_INS_BIN_SIZE};
|
||||
|
||||
U0 LexAttachDoc(CCompCtrl *cc,CLexFile *tmpf=NULL,
|
||||
@ -336,7 +336,7 @@ U0 LexAttachDoc(CCompCtrl *cc,CLexFile *tmpf=NULL,
|
||||
tmpf->full_name=StrNew(doc->filename.name);
|
||||
tmpf->doc=doc;
|
||||
while (doc_e!=doc) {
|
||||
if (Bt(cmp_type_flags_src_code,doc_e->type_u8))
|
||||
if (Bt(comp_type_flags_src_code,doc_e->type_u8))
|
||||
break;
|
||||
doc_e=doc_e->next;
|
||||
col=doc_e->min_col;
|
||||
|
@ -902,7 +902,7 @@ U0 ParseTryBlk(CCompCtrl *cc,I64 try_count)
|
||||
}
|
||||
|
||||
Bool ParseStatement(CCompCtrl *cc,I64 try_count=0,
|
||||
CCodeMisc *lb_break=NULL,I64 cmp_flags=CMPF_PRS_SEMICOLON)
|
||||
CCodeMisc *lb_break=NULL,I64 comp_flags=CMPF_PRS_SEMICOLON)
|
||||
{
|
||||
I64 i,fsp_flags=0;
|
||||
CHashExport *tmpex;
|
||||
@ -910,7 +910,7 @@ Bool ParseStatement(CCompCtrl *cc,I64 try_count=0,
|
||||
U8 *import_name;
|
||||
CHashFun *tmp_untry;
|
||||
CAOT *tmpaot;
|
||||
if (cmp_flags&CMPF_ONE_ASM_INS) {
|
||||
if (comp_flags&CMPF_ONE_ASM_INS) {
|
||||
if (cc->flags&CCF_AOT_COMPILE || cc->aot_depth)
|
||||
ParseAsmBlk(cc,CMPF_ONE_ASM_INS);
|
||||
else if (tmpaot=CompJoin(cc,CMPF_ASM_BLK|CMPF_ONE_ASM_INS))
|
||||
@ -928,7 +928,7 @@ Bool ParseStatement(CCompCtrl *cc,I64 try_count=0,
|
||||
cc->max_line=cc->lex_include_stack->line_num;
|
||||
if (Lex(cc)!=',') goto sm_done;
|
||||
} else if (cc->token==';') {
|
||||
if (cmp_flags&CMPF_PRS_SEMICOLON)
|
||||
if (comp_flags&CMPF_PRS_SEMICOLON)
|
||||
Lex(cc);
|
||||
if (cc->token!=',') goto sm_done;
|
||||
} else {
|
||||
@ -1206,7 +1206,7 @@ sm_prs_exp:
|
||||
if (!ParseExpression(cc,NULL,TRUE))
|
||||
throw('Compiler');
|
||||
sm_semicolon:
|
||||
if (cmp_flags&CMPF_PRS_SEMICOLON) {
|
||||
if (comp_flags&CMPF_PRS_SEMICOLON) {
|
||||
if (cc->token==';')
|
||||
Lex(cc);
|
||||
else if (cc->token!=',')
|
||||
|
Binary file not shown.
@ -25,22 +25,22 @@ U0 TOSInit()
|
||||
{
|
||||
switch (INS_REG_MACHINE_NUM) {
|
||||
case 1: //TAD Native Machine
|
||||
DefinePrint("CFG_RAM_DRVS",
|
||||
DefinePrint("CFG_RAM_DRIVES",
|
||||
"\"B\nScale2Mem(2048,0x100000,4*1024*1024*1024)\n\"");
|
||||
DefinePrint("CFG_HARD_DRVS","\"C\ns0xFE00\n0xFE10\n0\"");
|
||||
DefinePrint("CFG_DVD_DRVS","\"Ts0x1F0\n1\"");
|
||||
DefinePrint("CFG_DSK_CACHE","\"Scale2Mem(0x80000,0x8000000)\n\"");
|
||||
DefinePrint("CFG_HARD_DRIVES","\"C\ns0xFE00\n0xFE10\n0\"");
|
||||
DefinePrint("CFG_DVD_DRIVES","\"Ts0x1F0\n1\"");
|
||||
DefinePrint("CFG_DISK_CACHE","\"Scale2Mem(0x80000,0x8000000)\n\"");
|
||||
DefinePrint("TOS_HDS","\"CD\"");
|
||||
DefinePrint("TOS_MASTER_BOOT_DRVS","\"C\"");
|
||||
DefinePrint("TOS_MASTER_BOOT_DRIVES","\"C\"");
|
||||
break;
|
||||
default:
|
||||
DefinePrint("CFG_RAM_DRVS",
|
||||
DefinePrint("CFG_RAM_DRIVES",
|
||||
"\"B\nScale2Mem(2048,0x100000,4*1024*1024*1024)\n\"");
|
||||
DefinePrint("CFG_HARD_DRVS","\"\"");
|
||||
DefinePrint("CFG_DVD_DRVS","\"\"");
|
||||
DefinePrint("CFG_DSK_CACHE","\"Scale2Mem(0x80000,0x8000000)\n\"");
|
||||
DefinePrint("CFG_HARD_DRIVES","\"\"");
|
||||
DefinePrint("CFG_DVD_DRIVES","\"\"");
|
||||
DefinePrint("CFG_DISK_CACHE","\"Scale2Mem(0x80000,0x8000000)\n\"");
|
||||
DefinePrint("TOS_HDS","\"CD\"");
|
||||
DefinePrint("TOS_MASTER_BOOT_DRVS","\"C\"");
|
||||
DefinePrint("TOS_MASTER_BOOT_DRIVES","\"C\"");
|
||||
}
|
||||
} TOSInit;
|
||||
|
||||
@ -51,8 +51,8 @@ U0 TOSInit()
|
||||
"HeapInit\n130\nMemInit\n131\nVarInit\n132\n\n"
|
||||
#define CFG_DBGZ_OPTS "StaffMode\nMountIDEAuto\nCT"\
|
||||
"HeapInit\n0\nMemInit\n0\nVarInit\n0\n\n"
|
||||
#define TOS_CFG "\n" CFG_RAM_DRVS CFG_DVD_DRVS CFG_HARD_DRVS "\n"\
|
||||
CFG_DSK_CACHE CFG_OPTS
|
||||
#define TOS_CFG "\n" CFG_RAM_DRIVES CFG_DVD_DRIVES CFG_HARD_DRIVES "\n"\
|
||||
CFG_DISK_CACHE CFG_OPTS
|
||||
#define TOS_DVD_CFG "TB\n0x20000\nT\n\n\nStaffMode\nMountIDEAuto\nCT\n"
|
||||
#define TOS_DVD_DBG_CFG "A" CFG_DBG_DISTRO\
|
||||
"B\nScale2Mem(2048,0x40000)\n\n\n"\
|
||||
|
@ -20,7 +20,7 @@ public U0 TOSBootHDIns(U8 drv_let=0)
|
||||
drv_let=Letter2Letter(drv_let);
|
||||
In(TOS_CFG);
|
||||
BootHDIns(drv_let);
|
||||
if (StrOcc(TOS_MASTER_BOOT_DRVS,drv_let))
|
||||
if (StrOcc(TOS_MASTER_BOOT_DRIVES,drv_let))
|
||||
BootMHDIns(drv_let);
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ U0 DebugDistroFilePrep()
|
||||
Copy("C:/Zenith/TaskRep.HC", "A:/Zenith");
|
||||
|
||||
FileWrite("C:" CFG_DBG_DISTRO_FILE,
|
||||
bd->RAM_dsk,(bd->max_blk+1)<<BLK_SIZE_BITS);
|
||||
bd->RAM_disk,(bd->max_blk+1)<<BLK_SIZE_BITS);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
U0 RawAccess(I64 drv_let=0)
|
||||
{
|
||||
CDrive *dv=Letter2Drive(drv_let);
|
||||
CDrive *drive=Letter2Drive(drv_let);
|
||||
CBlkDev *bd=Letter2BlkDev(drv_let);
|
||||
I64 blk,old_offset,old_size;
|
||||
U8 *buf=MAlloc(BLK_SIZE);
|
||||
@ -8,7 +8,7 @@ U0 RawAccess(I64 drv_let=0)
|
||||
DriveRep;
|
||||
PressAKey;
|
||||
|
||||
ClassRep(dv);
|
||||
ClassRep(drive);
|
||||
PressAKey;
|
||||
|
||||
ClassRep(bd);
|
||||
@ -17,20 +17,20 @@ U0 RawAccess(I64 drv_let=0)
|
||||
//Temporarily change partition range to full device.
|
||||
//Normally, you are limited to just your partition.
|
||||
//This is obviously $BK,1$dangerous$BK,0$!
|
||||
old_offset=dv->drv_offset;
|
||||
old_size =dv->size;
|
||||
dv->drv_offset=0;
|
||||
dv->size=bd->max_blk+1;
|
||||
old_offset=drive->drv_offset;
|
||||
old_size =drive->size;
|
||||
drive->drv_offset=0;
|
||||
drive->size=bd->max_blk+1;
|
||||
|
||||
try {
|
||||
blk=GetI64("Blk to Read: ",old_offset,0,bd->max_blk);
|
||||
BlkRead(dv,buf,blk,1);
|
||||
BlkRead(drive,buf,blk,1);
|
||||
D(buf,BLK_SIZE);
|
||||
} catch
|
||||
PutExcept;
|
||||
|
||||
dv->drv_offset=old_offset;
|
||||
dv->size =old_size;
|
||||
drive->drv_offset=old_offset;
|
||||
drive->size =old_size;
|
||||
|
||||
Free(buf);
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
U0 UnusedSpaceRep()
|
||||
{
|
||||
I64 i;
|
||||
CDrive *dv;
|
||||
CDrive *drive;
|
||||
for (i=0;i<26;i++)
|
||||
if ((dv=Letter2Drive(i+'A',FALSE)) &&
|
||||
(dv->fs_type==FSt_FAT32 || dv->fs_type==FSt_REDSEA))
|
||||
if ((drive=Letter2Drive(i+'A',FALSE)) &&
|
||||
(drive->fs_type==FSt_FAT32 || drive->fs_type==FSt_REDSEA))
|
||||
"%C: %7.3f%% Free\n",
|
||||
Drive2Letter(dv),DriveUnused(Drive2Letter(dv))*100.0/(dv->size*BLK_SIZE);
|
||||
Drive2Letter(drive),DriveUnused(Drive2Letter(drive))*100.0/(drive->size*BLK_SIZE);
|
||||
}
|
||||
|
||||
UnusedSpaceRep;
|
||||
|
@ -83,7 +83,7 @@ U8 *TOSLinkCvt2(U8 *filename,I64 line_num)
|
||||
//Make your own LinkCvt routine
|
||||
U8 *res=NULL,*st;
|
||||
if (filename) {
|
||||
st=ExtChg(filename,"html");
|
||||
st=ExtChange(filename,"html");
|
||||
if (st && StrLen(st)>3 && !StrNCmp(st+1,":/",2))
|
||||
res=MStrPrint("http://www.templeos.org/Wb/%s#l%d",st+3,line_num);
|
||||
Free(st);
|
||||
@ -372,7 +372,7 @@ public U0 ToHtml(U8 *_in_name,U8 *_out_name=NULL,U8 *html_header=NULL,
|
||||
if (_out_name)
|
||||
out_name=ExtDefault(_out_name,"html");
|
||||
else
|
||||
out_name=ExtChg(_in_name,"html");
|
||||
out_name=ExtChange(_in_name,"html");
|
||||
|
||||
doc_in=DocRead(in_name);
|
||||
doc_out=Doc2Html(doc_in,html_header,body_header,body_footer,html_footer,
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
* ATAPI PIO $FG,2$CD/DVD$FG$ support with $FG,2$RedSea$FG$ file system. Can make bootable ISO files so you can roll-your-own distro's.
|
||||
|
||||
* $LK,"Partitioning",A="MN:DiskPrt"$ tool, installer, $FG,2$boot loaders$FG$ for CD/DVD and hard disk.
|
||||
* $LK,"Partitioning",A="MN:DiskPart"$ tool, installer, $FG,2$boot loaders$FG$ for CD/DVD and hard disk.
|
||||
|
||||
* $FG,2$Editor/Browser$FG$ for a new $LK,"Document Format",A="FI:::/Doc/DolDocOverview.DD"$. Source files and the command line window can have graphics, links, icons, trees, colors, super/sub scripts, margins. Everything is seamless through-out the tool chain. No need for separate resource files.
|
||||
|
||||
|
@ -37,7 +37,7 @@ $FG,2$'d'$FG$
|
||||
$ID,2$Make Dir.
|
||||
$ID,-2$
|
||||
$FG,2$'c'$FG$
|
||||
$ID,2$DiskChg (Remount removable media). Do not do this on blank disks.
|
||||
$ID,2$DiskChange (Remount removable media). Do not do this on blank disks.
|
||||
$ID,-2$
|
||||
$FG,2$'f'$FG$
|
||||
$ID,2$Format drive.
|
||||
@ -56,7 +56,7 @@ $ID,2$Burn CD/DVD ISO file. This burns a CD/DVD using the image file, $FG,2$$TX
|
||||
$ID,-2$
|
||||
|
||||
$FG,5$Instructions on Using CD/DVD's$FG$
|
||||
$ID,2$If you have not recompiled Kernel and defined your CD/DVD drive, exit the FileMgr and use $LK,"Mount",A="MN:Mount"$ to define your CD/DVD drive. Place a CD/DVD in the drive and press $FG,2$'c'$FG$ when on top of the CD/DVD drive letter to mount the drive. It will call $LK,"DiskChg",A="MN:DiskChg"$(), the ZenithOS cmd to mount removable media.
|
||||
$ID,2$If you have not recompiled Kernel and defined your CD/DVD drive, exit the FileMgr and use $LK,"Mount",A="MN:Mount"$ to define your CD/DVD drive. Place a CD/DVD in the drive and press $FG,2$'c'$FG$ when on top of the CD/DVD drive letter to mount the drive. It will call $LK,"DiskChange",A="MN:DiskChange"$(), the ZenithOS cmd to mount removable media.
|
||||
$ID,-2$
|
||||
|
||||
$FG,5$Instructions on Burning CD/DVD's$FG$
|
||||
|
@ -19,7 +19,7 @@ Edit
|
||||
|
||||
CDDVD
|
||||
{
|
||||
DiskChg(,'c');
|
||||
DiskChange(,'c');
|
||||
MountISOC(,'i');
|
||||
MakeRedSeaISOC(,'m');
|
||||
BurnISOFile(,'B');
|
||||
|
@ -23,7 +23,7 @@ $FG,2$Buf$FG$ Buffer
|
||||
$FG,2$Bwd$FG$ Backward
|
||||
$FG,2$CB$FG$ Call-Back, Code Block
|
||||
$FG,2$Cfg$FG$ Config
|
||||
$FG,2$Chg$FG$ Change
|
||||
$FG,2$Change$FG$ Change
|
||||
$FG,2$Check$FG$ Check
|
||||
$FG,2$Clip$FG$ Clipboard
|
||||
$FG,2$Clus$FG$ Cluster
|
||||
@ -110,7 +110,7 @@ $FG,2$Pri$FG$ Primary
|
||||
$FG,2$Prod$FG$ Product, Production
|
||||
$FG,2$Prof$FG$ Profile, Profiler
|
||||
$FG,2$Parse$FG$ Parse, Parser
|
||||
$FG,2$Prt$FG$ Partition
|
||||
$FG,2$Part$FG$ Partition
|
||||
$FG,2$FunSeg$FG$ Program Section
|
||||
$FG,2$Pt$FG$ Point
|
||||
$FG,2$Ptr$FG$ Pointer
|
||||
|
@ -14,7 +14,7 @@ Two ZenithOS partitions are highly recommended, so you can boot to a back-up and
|
||||
$ID,2$$LK,"Mount",A="MN:Mount"$() use if the drive is partitioned.
|
||||
$ID,2$This command mounts a drive making it accessible. For simplicity, sel $FG,2$'C'$FG$ as the first drive letter for your hard drive. The first partition will be $FG,2$'C'$FG$, second, $FG,2$'D'$FG$, etc. ZenithOS needs 3 numbers to utilize a hard drive -- base0, base1, and unit. When you enter a hexadecimal number, do it like in $FG,2$C$FG$ with a $FG,2$0x$FG$ prefix. If the probe was successful, you can just enter the number in the probe box instead of base0.
|
||||
$ID,-2$
|
||||
$LK,"DiskPrt",A="MN:DiskPrt"$($FG,2$'C'$FG$) use if drive is not partitioned
|
||||
$LK,"DiskPart",A="MN:DiskPart"$($FG,2$'C'$FG$) use if drive is not partitioned
|
||||
|
||||
$ID,2$This will perform a special $LK,"Mount",A="MN:Mount"$() automatically.
|
||||
|
||||
|
@ -8,9 +8,9 @@ $WW,1$* You run a risk of problems if you do file operations on the same files s
|
||||
|
||||
* The syntax highlighting occassionally glitches. The compiler doesn't.
|
||||
|
||||
* Call $LK,"DiskChg",A="MN:DiskChg"$() when you insert a new removable media.
|
||||
* Call $LK,"DiskChange",A="MN:DiskChange"$() when you insert a new removable media.
|
||||
|
||||
* Accessing CD/DVD's is flacky. Try $LK,"Drive",A="MN:Drive"$() or $LK,"DiskChg",A="MN:DiskChg"$() twice.
|
||||
* Accessing CD/DVD's is flacky. Try $LK,"Drive",A="MN:Drive"$() or $LK,"DiskChange",A="MN:DiskChange"$() twice.
|
||||
|
||||
* You can only $FG,2$extern$FG$ something once. There is a varient called $FG,2$_extern$FG$ which binds a HolyC definition to a asm sym. This, too, can only be done once.
|
||||
|
||||
|
22
src/Home/DemoOutPage.TXT
Executable file
22
src/Home/DemoOutPage.TXT
Executable file
@ -0,0 +1,22 @@
|
||||
The Temple Operating System
|
||||
|
||||
ZenithOS File Downloads (100% Public Domain)
|
||||
|
||||
ZenithOS is a free, public domain, open source, x86_64, non-preemptive
|
||||
multi-tasking, multi-cored, ring-0-only, single-address-map
|
||||
(identity-mapped), non-networked, PC operating system. Paging is,
|
||||
basically, not used.
|
||||
|
||||
The CIA obsfucates to foil India, China, Russia and Korea. They make
|
||||
things more complicated than necessary. ZenithOS is more simple than
|
||||
necessary. It is obnoxiously simple. If you look at this
|
||||
"Hello World" joke, you can see why I capped the line count of
|
||||
TempleOS at 100,000.
|
||||
|
||||
God said TempleOS must be perfect, so backward compatibility is not
|
||||
promised.
|
||||
|
||||
I, Terry Davis, wrote all 80,849 lines of TempleOS over the last 16.5
|
||||
years, including the 64-bit compiler. I have been a professional
|
||||
operating system developer since 1990 when I worked on Ticketmaster's
|
||||
VAX OS.
|
46
src/Home/DemoOutPage.html
Executable file
46
src/Home/DemoOutPage.html
Executable file
@ -0,0 +1,46 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
||||
<meta name="generator" content="ZenithOS V0.10">
|
||||
<style type="text/css">
|
||||
.cF0{color:#000000;background-color:#ffffff;}
|
||||
.cF1{color:#0000aa;background-color:#ffffff;}
|
||||
.cF2{color:#00aa00;background-color:#ffffff;}
|
||||
.cF3{color:#00aaaa;background-color:#ffffff;}
|
||||
.cF4{color:#aa0000;background-color:#ffffff;}
|
||||
.cF5{color:#aa00aa;background-color:#ffffff;}
|
||||
.cF6{color:#aa5500;background-color:#ffffff;}
|
||||
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
||||
.cF8{color:#555555;background-color:#ffffff;}
|
||||
.cF9{color:#5555ff;background-color:#ffffff;}
|
||||
.cFA{color:#55ff55;background-color:#ffffff;}
|
||||
.cFB{color:#55ffff;background-color:#ffffff;}
|
||||
.cFC{color:#ff5555;background-color:#ffffff;}
|
||||
.cFD{color:#ff55ff;background-color:#ffffff;}
|
||||
.cFE{color:#ffff55;background-color:#ffffff;}
|
||||
.cFF{color:#ffffff;background-color:#ffffff;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<pre style="font-family:courier;font-size:10pt">
|
||||
<a name="l1"></a><span class=cF5> </span><a href="http://www.templeos.org"><span class=cF5>The Temple Operating System</span></a><span class=cF0>
|
||||
<a name="l2"></a>
|
||||
<a name="l3"></a></span><a href="http://www.templeos.org/Downloads"><span class=cF4>ZenithOS File Downloads (100% Public Domain)</span></a><span class=cF0>
|
||||
<a name="l4"></a>
|
||||
<a name="l5"></a>ZenithOS is a free, public domain, open source, x86_64, non-preemptive
|
||||
<a name="l6"></a>multi-tasking, multi-cored, ring-0-only, single-address-map (identity-mapped),
|
||||
<a name="l7"></a>non-networked, PC operating system. Paging is, basically, not used.
|
||||
<a name="l8"></a>
|
||||
<a name="l9"></a>The CIA obsfucates to foil India, China, Russia and Korea. They make things
|
||||
<a name="l10"></a>more complicated than necessary. ZenithOS is more simple than necessary. It is
|
||||
<a name="l11"></a>obnoxiously simple. If you look at this </span><a href="http://www.ariel.com.au/jokes/The_Evolution_of_a_Programmer.html"><span class=cF0>"Hello World" joke</span></a><span class=cF0>, you can see why I
|
||||
<a name="l12"></a>capped the line count of TempleOS at 100,000.
|
||||
<a name="l13"></a>
|
||||
<a name="l14"></a>God said TempleOS must be perfect, so backward compatibility is not promised.
|
||||
<a name="l15"></a>
|
||||
<a name="l16"></a>I, Terry Davis, wrote all 80,849 lines of TempleOS over the last 16.5 years,
|
||||
<a name="l17"></a>including the 64-bit compiler. I have been a professional operating system
|
||||
<a name="l18"></a>developer since 1990 when I worked on Ticketmaster's VAX OS.
|
||||
</span></pre></body>
|
||||
</html>
|
42
src/Home/DemoPoemFwd.DD
Executable file
42
src/Home/DemoPoemFwd.DD
Executable file
@ -0,0 +1,42 @@
|
||||
To a Waterfowl;
|
||||
by William Cullen Bryant
|
||||
|
||||
Whither, 'midst falling dew,
|
||||
While glow the heavens with the last steps of day,
|
||||
Far, through their rosy depths, dost thou pursue
|
||||
Thy solitary way?
|
||||
|
||||
Vainly the fowler's eye
|
||||
Might mark thy distant flight to do thee wrong,
|
||||
As, darkly painted on the crimson sky,
|
||||
Thy figure floats along.
|
||||
|
||||
Seek'st thou the plashy brink
|
||||
Of weedy lake, or marge of river wide,
|
||||
Or where the rocking billows rise and sink
|
||||
On the chafed ocean side?
|
||||
|
||||
There is a Power whose care
|
||||
Teaches thy way along that pathless coast,--
|
||||
The desert and illimitable air,--
|
||||
Lone wandering, but not lost.
|
||||
|
||||
All day thy wings have fann'd
|
||||
At that far height, the cold thin atmosphere:
|
||||
Yet stoop not, weary, to the welcome land,
|
||||
Though the dark night is near.
|
||||
|
||||
And soon that toil shall end,
|
||||
Soon shalt thou find a summer home, and rest,
|
||||
And scream among thy fellows; reed shall bend
|
||||
Soon o'er thy sheltered nest.
|
||||
|
||||
Thou'rt gone, the abyss of heaven
|
||||
Hath swallowed up thy form; yet, on my heart
|
||||
Deeply hath sunk the lesson thou hast given,
|
||||
And shall not soon depart.
|
||||
|
||||
He, who, from zone to zone,
|
||||
Guides through the boundless sky thy certain flight,
|
||||
In the long way that I must tread alone,
|
||||
Will lead my steps aright.
|
BIN
src/Home/DemoSortedF64.DATA
Executable file
BIN
src/Home/DemoSortedF64.DATA
Executable file
Binary file not shown.
12
src/Home/DemoSortedF64.DD
Executable file
12
src/Home/DemoSortedF64.DD
Executable file
@ -0,0 +1,12 @@
|
||||
//This is sorted.
|
||||
0.007753
|
||||
0.013270
|
||||
0.110048
|
||||
0.275205
|
||||
0.482805
|
||||
0.582046
|
||||
0.761686
|
||||
0.838419
|
||||
0.861141
|
||||
0.869789
|
||||
|
BIN
src/Home/DemoUnsortedF64.DATA
Executable file
BIN
src/Home/DemoUnsortedF64.DATA
Executable file
Binary file not shown.
12
src/Home/DemoUnsortedF64.DD
Executable file
12
src/Home/DemoUnsortedF64.DD
Executable file
@ -0,0 +1,12 @@
|
||||
//This is unsorted.
|
||||
0.110048
|
||||
0.275205
|
||||
0.013270
|
||||
0.007753
|
||||
0.838419
|
||||
0.582046
|
||||
0.869789
|
||||
0.482805
|
||||
0.861141
|
||||
0.761686
|
||||
|
93
src/Home/DemoWebLog.DD
Executable file
93
src/Home/DemoWebLog.DD
Executable file
@ -0,0 +1,93 @@
|
||||
$WW+H,1$$WW,0$
|
||||
|
||||
Hits on /index.html
|
||||
'-' is a dup. '+' is not a dup.
|
||||
06/22/17 Dups: 0 Total: 0 Uniques: 0
|
||||
|
||||
|
||||
Hits on /index.html
|
||||
06/22/17 08:
|
||||
06/22/17 09:
|
||||
06/22/17 10:
|
||||
06/22/17 11:
|
||||
06/22/17 12:
|
||||
06/22/17 13:
|
||||
06/22/17 14:
|
||||
06/22/17 15:
|
||||
06/22/17 16:
|
||||
06/22/17 17:
|
||||
06/22/17 18:
|
||||
06/22/17 19:
|
||||
06/22/17 20:
|
||||
06/22/17 21:
|
||||
06/22/17 22:
|
||||
Total:0 Dups:0 Uniques:0
|
||||
|
||||
|
||||
Hits on /index.html
|
||||
|
||||
|
||||
|
||||
File Hits
|
||||
15:/Downloads
|
||||
2:/Downloads/Linux/TOSZ.CPP
|
||||
5:/Downloads/Linux/gw
|
||||
10:/Downloads/ReadMe.TXT
|
||||
5:/Downloads/TOS_Distro.ISO
|
||||
2:/Downloads/TOS_Supplemental1.ISO.C
|
||||
2:/Main170621.JPG
|
||||
5:/Main170622.JPG
|
||||
1:/Pics
|
||||
1:/Pictures
|
||||
51:/TempleOS.html
|
||||
1:/TempleOS406.html
|
||||
1:/TempleOSCD.ISO
|
||||
38:/Videos
|
||||
1:/Videos/170620/01JediMonkDrumSet.MP4
|
||||
1:/Videos/170620/02AdamTheOna.MP4
|
||||
1:/Videos/170620/03HymnBought.MP4
|
||||
1:/Videos/170620/05GlintedPicoBlack.MP4
|
||||
69:/Videos/170621/01WinSomeLoseSome.MP4
|
||||
14:/Videos/170622/01HymnSilently.MP4
|
||||
13:/Videos/170622/02HymnSilentlyGraphics.MP4
|
||||
26:/Videos/170622/03HymnSilentlyDrums.mp4
|
||||
5:/Videos/Hymns/TADHymnSilently.mp4
|
||||
4:/Videos/Hymns/TADHymns03.mp4
|
||||
3:/Videos/Hymns/TADHymns07.mp4
|
||||
19:/Videos/TempleOS/170621CompilerResume.mp4
|
||||
8:/Videos/TempleOS/170621PressRelease.mp4
|
||||
4:/Videos/TempleOS/170621SysTaskIntsDesign.mp4
|
||||
8:/Videos/TempleOS/Games/KeepAway.mp4
|
||||
6:/Videos/TempleOS/Games/X-Caliber.mp4
|
||||
4:/Videos/as
|
||||
|
||||
|
||||
|
||||
Downloads of /TOS_Distro.ISO
|
||||
06/22/17 Dups: 0 Total: 5 Uniques: 5
|
||||
|
||||
|
||||
Downloads of /TOS_Distro.ISO
|
||||
'-' is a dup. '+' is not a dup.
|
||||
06/22/17 08:
|
||||
06/22/17 09:
|
||||
06/22/17 10:
|
||||
06/22/17 11:
|
||||
06/22/17 12:
|
||||
06/22/17 13:
|
||||
06/22/17 14:
|
||||
06/22/17 15:
|
||||
06/22/17 16:
|
||||
06/22/17 17:
|
||||
06/22/17 18:
|
||||
06/22/17 19:
|
||||
06/22/17 20: +
|
||||
06/22/17 21: ++
|
||||
06/22/17 22: ++
|
||||
Total:5 Dups:0 Uniques:5
|
||||
|
||||
|
||||
Downloads of /TOS_Distro.ISO
|
||||
5:http://www.templeos.org/Downloads/
|
||||
|
||||
|
@ -1,13 +0,0 @@
|
||||
Cd(__DIR__);;
|
||||
|
||||
//If these are not present in /Home, it uses the version in the root dir. You
|
||||
//can make your own, modified, version of these files in your /Home directory.
|
||||
#include "~/HomeLocalize"
|
||||
#include "/Zenith/Boot/MakeBoot"
|
||||
#include "/Zenith/Utils/MakeUtils"
|
||||
#include "~/HomeWrappers"
|
||||
MapFileLoad("::/Kernel/Kernel");
|
||||
MapFileLoad("::/Compiler/Compiler");
|
||||
#include "~/HomeKeyPlugIns"
|
||||
#include "~/HomeSys"
|
||||
Cd("..");;
|
BIN
src/Kernel.BIN.C
BIN
src/Kernel.BIN.C
Binary file not shown.
@ -415,7 +415,7 @@ Bool ATAPIReadBlks2(CBlkDev *bd,F64 timeout,U8 *buf,
|
||||
|
||||
U0 ATAPIReadBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 count)
|
||||
{
|
||||
CDrive *dv=Letter2Drive(bd->first_drv_let);
|
||||
CDrive *drive=Letter2Drive(bd->first_drive_let);
|
||||
I64 retry,spc=bd->blk_size>>BLK_SIZE_BITS,n,blk2,
|
||||
l2=bd->max_reads<<1+spc<<1;
|
||||
U8 *dvd_buf=MAlloc(l2<<BLK_SIZE_BITS);
|
||||
@ -424,8 +424,8 @@ U0 ATAPIReadBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 count)
|
||||
blk2=0;
|
||||
else
|
||||
blk2=FloorU64(blk-bd->max_reads,spc);
|
||||
if (blk2+l2>dv->size+dv->drv_offset)
|
||||
l2=dv->size+dv->drv_offset-blk2;
|
||||
if (blk2+l2>drive->size+drive->drv_offset)
|
||||
l2=drive->size+drive->drv_offset-blk2;
|
||||
n=(l2+spc-1)/spc;
|
||||
|
||||
retry=4;
|
||||
@ -436,16 +436,16 @@ U0 ATAPIReadBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 count)
|
||||
if (!retry)
|
||||
ATAPIReadBlks2(bd,0,dvd_buf,blk2/spc,n,TRUE);
|
||||
if (bd->flags & BDF_READ_CACHE)
|
||||
DiskCacheAdd(dv,dvd_buf,blk2,n*spc);
|
||||
DiskCacheAdd(drive,dvd_buf,blk2,n*spc);
|
||||
MemCpy(buf,dvd_buf+(blk-blk2)<<BLK_SIZE_BITS,count<<BLK_SIZE_BITS);
|
||||
}
|
||||
Free(dvd_buf);
|
||||
}
|
||||
|
||||
Bool ATARBlks(CDrive *dv,U8 *buf, I64 blk, I64 count)
|
||||
Bool ATARBlks(CDrive *drive,U8 *buf, I64 blk, I64 count)
|
||||
{
|
||||
I64 n;
|
||||
CBlkDev *bd=dv->bd;
|
||||
CBlkDev *bd=drive->bd;
|
||||
while (count>0) {
|
||||
n=count;
|
||||
if (n>bd->max_reads)
|
||||
@ -579,10 +579,10 @@ U0 ATAPIWriteBlks(CBlkDev *bd,U8 *buf, I64 native_blk, I64 count)
|
||||
ATAWaitNotBUSY(bd,0);
|
||||
}
|
||||
|
||||
Bool ATAWBlks(CDrive *dv,U8 *buf, I64 blk, I64 count)
|
||||
Bool ATAWBlks(CDrive *drive,U8 *buf, I64 blk, I64 count)
|
||||
{
|
||||
I64 n,spc;
|
||||
CBlkDev *bd=dv->bd;
|
||||
CBlkDev *bd=drive->bd;
|
||||
Bool unlock;
|
||||
spc=bd->blk_size>>BLK_SIZE_BITS;
|
||||
if (bd->type==BDT_ATAPI) {
|
||||
|
@ -204,9 +204,9 @@ CATARep *ATARepFind(CATARep *haystack_head,I64 needle_num)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CATARep *ATAIDDrives(CATARep *head,CATARep **_ata_drv,CATARep **_atapi_drv)
|
||||
CATARep *ATAIDDrives(CATARep *head,CATARep **_ata_drive,CATARep **_atapi_drive)
|
||||
{//This is for when trying to sort-out main hard drives and CD/DVD drives.
|
||||
CATARep *res=NULL,*tmpha=head,*ata_drv=NULL,*atapi_drv=NULL;
|
||||
CATARep *res=NULL,*tmpha=head,*ata_drive=NULL,*atapi_drive=NULL;
|
||||
CBlkDev *bd;
|
||||
Bool was_silent=Silent,ins_found=FALSE;
|
||||
bd=Letter2BlkDev(':',FALSE);
|
||||
@ -215,42 +215,42 @@ CATARep *ATAIDDrives(CATARep *head,CATARep **_ata_drv,CATARep **_atapi_drv)
|
||||
if (!res && bd && bd->type==tmpha->type) {
|
||||
if (bd->type==BDT_ATAPI &&
|
||||
bd->base0==tmpha->base0 && bd->unit==tmpha->unit)
|
||||
res=atapi_drv=tmpha;
|
||||
res=atapi_drive=tmpha;
|
||||
else if (bd->type==BDT_ATA && bd->base0==tmpha->base0 &&
|
||||
bd->base1==tmpha->base1 && bd->unit==tmpha->unit)
|
||||
res=ata_drv=tmpha;
|
||||
res=ata_drive=tmpha;
|
||||
}
|
||||
if (!res || res->type!=tmpha->type) {
|
||||
if (tmpha->type==BDT_ATA) {
|
||||
if (!ata_drv || tmpha->unit<ata_drv->unit ||
|
||||
tmpha->unit==ata_drv->unit && tmpha->num<ata_drv->num)
|
||||
ata_drv=tmpha;
|
||||
if (!ata_drive || tmpha->unit<ata_drive->unit ||
|
||||
tmpha->unit==ata_drive->unit && tmpha->num<ata_drive->num)
|
||||
ata_drive=tmpha;
|
||||
} else if (tmpha->type==BDT_ATAPI) {
|
||||
if (!atapi_drv || !ins_found && (tmpha->unit<atapi_drv->unit ||
|
||||
tmpha->unit==atapi_drv->unit && tmpha->num<atapi_drv->num))
|
||||
atapi_drv=tmpha;
|
||||
if (!atapi_drive || !ins_found && (tmpha->unit<atapi_drive->unit ||
|
||||
tmpha->unit==atapi_drive->unit && tmpha->num<atapi_drive->num))
|
||||
atapi_drive=tmpha;
|
||||
}
|
||||
}
|
||||
if (tmpha->type==BDT_ATAPI && bd && bd->type==BDT_ATA &&
|
||||
tmpha->base0==blkdev.ins_base0 && tmpha->unit==blkdev.ins_unit) {
|
||||
if (!ins_found) {
|
||||
atapi_drv=tmpha;
|
||||
atapi_drive=tmpha;
|
||||
ins_found=TRUE;
|
||||
}
|
||||
}
|
||||
tmpha=tmpha->next;
|
||||
}
|
||||
if (_ata_drv) *_ata_drv =ata_drv;
|
||||
if (_atapi_drv) *_atapi_drv=atapi_drv;
|
||||
if (_ata_drive) *_ata_drive =ata_drive;
|
||||
if (_atapi_drive) *_atapi_drive=atapi_drive;
|
||||
return res;
|
||||
}
|
||||
|
||||
CBlkDev *ATAMount(U8 first_drv_let,I64 type,I64 base0,I64 base1,I64 unit)
|
||||
CBlkDev *ATAMount(U8 first_drive_let,I64 type,I64 base0,I64 base1,I64 unit)
|
||||
{
|
||||
CBlkDev *res;
|
||||
if (0<=first_drv_let-'A'<DRVS_NUM && (type==BDT_ATA || type==BDT_ATAPI) &&
|
||||
if (0<=first_drive_let-'A'<DRIVES_NUM && (type==BDT_ATA || type==BDT_ATAPI) &&
|
||||
0<=unit<=1) {
|
||||
res=BlkDevNextFreeSlot(first_drv_let,type);
|
||||
res=BlkDevNextFreeSlot(first_drive_let,type);
|
||||
res->unit=unit;
|
||||
res->base0=base0;
|
||||
res->base1=base1;
|
||||
@ -265,23 +265,23 @@ I64 MountIDEAuto()
|
||||
//It uses 'C' and 'T' as first drive letters or whatever you set
|
||||
//in config when compiling Kernel.BIN.
|
||||
I64 res=0;
|
||||
CATARep *head=NULL,*ata_drv=NULL,*atapi_drv=NULL,*tmpha;
|
||||
CATARep *head=NULL,*ata_drive=NULL,*atapi_drive=NULL,*tmpha;
|
||||
ATARep(FALSE,TRUE,&head);
|
||||
ATAIDDrives(head,&ata_drv,&atapi_drv);
|
||||
if (ata_drv && ATAMount(blkdev.first_hd_drv_let,BDT_ATA,
|
||||
ata_drv->base0,ata_drv->base1,ata_drv->unit))
|
||||
ATAIDDrives(head,&ata_drive,&atapi_drive);
|
||||
if (ata_drive && ATAMount(blkdev.first_hd_drive_let,BDT_ATA,
|
||||
ata_drive->base0,ata_drive->base1,ata_drive->unit))
|
||||
res++;
|
||||
if (atapi_drv && ATAMount(blkdev.first_dvd_drv_let,BDT_ATAPI,
|
||||
atapi_drv->base0,atapi_drv->base1,atapi_drv->unit))
|
||||
if (atapi_drive && ATAMount(blkdev.first_dvd_drive_let,BDT_ATAPI,
|
||||
atapi_drive->base0,atapi_drive->base1,atapi_drive->unit))
|
||||
res++;
|
||||
tmpha=head;
|
||||
while (tmpha) {
|
||||
if (tmpha!=ata_drv && tmpha!=atapi_drv) {
|
||||
if (tmpha->type==BDT_ATA && ATAMount(blkdev.first_hd_drv_let,BDT_ATA,
|
||||
if (tmpha!=ata_drive && tmpha!=atapi_drive) {
|
||||
if (tmpha->type==BDT_ATA && ATAMount(blkdev.first_hd_drive_let,BDT_ATA,
|
||||
tmpha->base0,tmpha->base1,tmpha->unit))
|
||||
res++;
|
||||
else if (tmpha->type==BDT_ATAPI &&
|
||||
ATAMount(blkdev.first_dvd_drv_let,BDT_ATAPI,
|
||||
ATAMount(blkdev.first_dvd_drive_let,BDT_ATAPI,
|
||||
tmpha->base0,tmpha->base1,tmpha->unit))
|
||||
res++;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ U0 BlkDevLockFwdingSet(CBlkDev *bd)
|
||||
break;
|
||||
case BDT_ISO_FILE_READ:
|
||||
case BDT_ISO_FILE_WRITE:
|
||||
bd->lock_fwding=Letter2BlkDev(*bd->file_dsk_name);
|
||||
bd->lock_fwding=Letter2BlkDev(*bd->file_disk_name);
|
||||
break;
|
||||
case BDT_ATA:
|
||||
case BDT_ATAPI:
|
||||
@ -25,29 +25,29 @@ U0 BlkDevLockFwdingSet(CBlkDev *bd)
|
||||
}
|
||||
|
||||
I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
|
||||
Bool whole_drv,Bool make_free)
|
||||
Bool whole_drive,Bool make_free)
|
||||
{//It will mount just one partition of prt_num>=0.
|
||||
//When repartitioing whole drive, whole_drv=TRUE.
|
||||
//When repartitioing whole drive, whole_drive=TRUE.
|
||||
I64 i,j,ext_base,offset,res=0,num=0;
|
||||
CDrive *dv;
|
||||
CDrive *drive;
|
||||
CRedSeaBoot br;
|
||||
CMasterBoot mbr;
|
||||
|
||||
bd->bd_signature=BD_SIGNATURE_VAL;
|
||||
if (make_free)
|
||||
dv=DriveMakeFreeSlot(bd->first_drv_let);
|
||||
drive=DriveMakeFreeSlot(bd->first_drive_let);
|
||||
else
|
||||
dv=DriveMakeFreeSlot(DriveNextFreeLet(bd->first_drv_let));
|
||||
dv->bd=bd;
|
||||
dv->drv_offset=bd->drv_offset;
|
||||
dv->size=bd->max_blk+1-bd->drv_offset;
|
||||
drive=DriveMakeFreeSlot(DriveNextFreeLet(bd->first_drive_let));
|
||||
drive->bd=bd;
|
||||
drive->drv_offset=bd->drv_offset;
|
||||
drive->size=bd->max_blk+1-bd->drv_offset;
|
||||
switch (bd->type) {
|
||||
case BDT_RAM:
|
||||
case BDT_ISO_FILE_READ:
|
||||
case BDT_ISO_FILE_WRITE:
|
||||
dv->dv_signature=DRV_SIGNATURE_VAL;
|
||||
dv->prt_num=num;
|
||||
dv->fs_type=FSt_REDSEA;
|
||||
drive->drive_signature=DRIVE_SIGNATURE_VAL;
|
||||
drive->prt_num=num;
|
||||
drive->fs_type=FSt_REDSEA;
|
||||
//This is to force creation of a RAM
|
||||
//drive during boot, so it is probably
|
||||
//MAlloced to the same addr and can
|
||||
@ -58,20 +58,20 @@ I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
|
||||
if (BlkDevInit(bd))
|
||||
res++;
|
||||
else
|
||||
dv->dv_signature=0;
|
||||
drive->drive_signature=0;
|
||||
break;
|
||||
case BDT_ATA:
|
||||
dv->dv_signature=DRV_SIGNATURE_VAL; //Temporarily validate
|
||||
drive->drive_signature=DRIVE_SIGNATURE_VAL; //Temporarily validate
|
||||
if (!BlkDevInit(bd))
|
||||
dv->dv_signature=0; //Revoke validation
|
||||
drive->drive_signature=0; //Revoke validation
|
||||
else {
|
||||
dv->dv_signature=0; //Revoke validation
|
||||
if (whole_drv) {
|
||||
dv->dv_signature=DRV_SIGNATURE_VAL;
|
||||
dv->prt_num=num;
|
||||
drive->drive_signature=0; //Revoke validation
|
||||
if (whole_drive) {
|
||||
drive->drive_signature=DRIVE_SIGNATURE_VAL;
|
||||
drive->prt_num=num;
|
||||
res++;
|
||||
dv->fs_type=FSt_REDSEA;
|
||||
dv->size=bd->max_blk+1-bd->drv_offset;
|
||||
drive->fs_type=FSt_REDSEA;
|
||||
drive->size=bd->max_blk+1-bd->drv_offset;
|
||||
//The following read is a test read.
|
||||
//if it hangs, the drive is not supported.
|
||||
ATAReadBlks(bd,&mbr,0,1);
|
||||
@ -87,19 +87,19 @@ I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
|
||||
for (i=0;i<4 && (prt_num<0 || num<=prt_num);i++) {
|
||||
if (mbr.p[i].type) {
|
||||
if (make_free)
|
||||
dv=DriveMakeFreeSlot(bd->first_drv_let+res);
|
||||
drive=DriveMakeFreeSlot(bd->first_drive_let+res);
|
||||
else
|
||||
dv=DriveMakeFreeSlot(DriveNextFreeLet(bd->first_drv_let+res));
|
||||
dv->bd=bd;
|
||||
dv->drv_offset=mbr.p[i].offset+offset;
|
||||
dv->size =mbr.p[i].size;
|
||||
drive=DriveMakeFreeSlot(DriveNextFreeLet(bd->first_drive_let+res));
|
||||
drive->bd=bd;
|
||||
drive->drv_offset=mbr.p[i].offset+offset;
|
||||
drive->size =mbr.p[i].size;
|
||||
switch (mbr.p[i].type) {
|
||||
case MBR_PT_REDSEA:
|
||||
dv->dv_signature=DRV_SIGNATURE_VAL;
|
||||
dv->prt_num=num;
|
||||
drive->drive_signature=DRIVE_SIGNATURE_VAL;
|
||||
drive->prt_num=num;
|
||||
res++;
|
||||
dv->fs_type=FSt_REDSEA;
|
||||
RedSeaInit(dv);
|
||||
drive->fs_type=FSt_REDSEA;
|
||||
RedSeaInit(drive);
|
||||
break;
|
||||
case MBR_PT_FAT32a:
|
||||
case MBR_PT_FAT32b:
|
||||
@ -107,38 +107,38 @@ I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
|
||||
case MBR_PT_FAT32d:
|
||||
case MBR_PT_FAT32e:
|
||||
case MBR_PT_FAT32f:
|
||||
ATAReadBlks(bd,&br,dv->drv_offset,1);
|
||||
dv->dv_signature=DRV_SIGNATURE_VAL;
|
||||
dv->prt_num=num;
|
||||
ATAReadBlks(bd,&br,drive->drv_offset,1);
|
||||
drive->drive_signature=DRIVE_SIGNATURE_VAL;
|
||||
drive->prt_num=num;
|
||||
res++;
|
||||
if (br.signature==MBR_PT_REDSEA) {
|
||||
dv->fs_type=FSt_REDSEA;
|
||||
RedSeaInit(dv);
|
||||
drive->fs_type=FSt_REDSEA;
|
||||
RedSeaInit(drive);
|
||||
} else {
|
||||
dv->fs_type=FSt_FAT32;
|
||||
FAT32Init(dv);
|
||||
drive->fs_type=FSt_FAT32;
|
||||
FAT32Init(drive);
|
||||
}
|
||||
break;
|
||||
case MBR_PT_NTFS:
|
||||
dv->dv_signature=DRV_SIGNATURE_VAL;
|
||||
dv->prt_num=num;
|
||||
drive->drive_signature=DRIVE_SIGNATURE_VAL;
|
||||
drive->prt_num=num;
|
||||
res++;
|
||||
dv->fs_type=FSt_NTFS;
|
||||
drive->fs_type=FSt_NTFS;
|
||||
break;
|
||||
case 5:
|
||||
case 15:
|
||||
j=i;
|
||||
break;
|
||||
default:
|
||||
dv->dv_signature=DRV_SIGNATURE_VAL;
|
||||
dv->prt_num=num;
|
||||
drive->drive_signature=DRIVE_SIGNATURE_VAL;
|
||||
drive->prt_num=num;
|
||||
res++;
|
||||
dv->fs_type=FSt_UNKNOWN;
|
||||
drive->fs_type=FSt_UNKNOWN;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
}
|
||||
if (Letter2BlkDevType(bd->first_drv_let+res)!=bd->type)
|
||||
if (Letter2BlkDevType(bd->first_drive_let+res)!=bd->type)
|
||||
break;
|
||||
if (j<0)
|
||||
break;
|
||||
@ -153,11 +153,11 @@ I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
|
||||
}
|
||||
break;
|
||||
case BDT_ATAPI:
|
||||
dv->dv_signature=DRV_SIGNATURE_VAL;
|
||||
dv->prt_num=num;
|
||||
drive->drive_signature=DRIVE_SIGNATURE_VAL;
|
||||
drive->prt_num=num;
|
||||
res++;
|
||||
dv->fs_type=FSt_ISO9660; //Start with this
|
||||
dv->size=0;
|
||||
drive->fs_type=FSt_ISO9660; //Start with this
|
||||
drive->size=0;
|
||||
break;
|
||||
}
|
||||
if (res)
|
||||
@ -169,9 +169,9 @@ I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
|
||||
|
||||
Bool DriveEnable(U8 drv_let,Bool val)
|
||||
{//Can unmount or remount, but not mount the first time.
|
||||
CDrive *dv;
|
||||
if (dv=Letter2Drive(drv_let,FALSE))
|
||||
return !LBEqu(&dv->fs_type,FStf_DISABLE,!val);
|
||||
CDrive *drive;
|
||||
if (drive=Letter2Drive(drv_let,FALSE))
|
||||
return !LBEqu(&drive->fs_type,FStf_DISABLE,!val);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
@ -227,9 +227,9 @@ U0 BlkDevsInitAll()
|
||||
CBlkDev *bd;
|
||||
I64 i;
|
||||
blkdev.blkdevs=CAlloc(sizeof(CBlkDev)*BLKDEVS_NUM);
|
||||
blkdev.drvs=CAlloc(sizeof(CDrive)*DRVS_NUM);
|
||||
for (i=0;i<DRVS_NUM;i++)
|
||||
blkdev.let_to_drv[i]=&blkdev.drvs[i];
|
||||
blkdev.drvs=CAlloc(sizeof(CDrive)*DRIVES_NUM);
|
||||
for (i=0;i<DRIVES_NUM;i++)
|
||||
blkdev.let_to_drive[i]=&blkdev.drvs[i];
|
||||
#exe {
|
||||
if (kernel_cfg->opts[CFG_MOUNT_IDE_AUTO])
|
||||
StreamPrint("MountIDEAuto;");
|
||||
|
@ -1,10 +1,10 @@
|
||||
#define ZERO_BUF_SIZE 2048
|
||||
U0 BlkWriteZero(CDrive *dv,I64 blk,I64 count)
|
||||
U0 BlkWriteZero(CDrive *drive,I64 blk,I64 count)
|
||||
{//Fill blk count with zeros in Drive.
|
||||
I64 n;
|
||||
U8 *z=CAlloc(ZERO_BUF_SIZE<<BLK_SIZE_BITS);
|
||||
Bool show_progress;
|
||||
if (count>ZERO_BUF_SIZE && dv->bd->type!=BDT_RAM) {
|
||||
if (count>ZERO_BUF_SIZE && drive->bd->type!=BDT_RAM) {
|
||||
progress1=0; progress1_max=count;
|
||||
StrCpy(progress1_desc,"Zeroing");
|
||||
show_progress=TRUE;
|
||||
@ -14,7 +14,7 @@ U0 BlkWriteZero(CDrive *dv,I64 blk,I64 count)
|
||||
n=count;
|
||||
if (n>ZERO_BUF_SIZE)
|
||||
n=ZERO_BUF_SIZE;
|
||||
BlkWrite(dv,z,blk,n);
|
||||
BlkWrite(drive,z,blk,n);
|
||||
blk+=n;
|
||||
count-=n;
|
||||
if (show_progress)
|
||||
@ -28,82 +28,82 @@ U0 BlkWriteZero(CDrive *dv,I64 blk,I64 count)
|
||||
}
|
||||
}
|
||||
|
||||
Bool BlkRead(CDrive *dv,U8 *buf, I64 blk, I64 count)
|
||||
Bool BlkRead(CDrive *drive,U8 *buf, I64 blk, I64 count)
|
||||
{//Read blk count from Drive to buf.
|
||||
Bool res=TRUE,unlock;
|
||||
CBlkDev *bd=dv->bd;
|
||||
CBlkDev *bd=drive->bd;
|
||||
if (count<=0) return TRUE;
|
||||
DriveCheck(dv);
|
||||
DriveCheck(drive);
|
||||
try {
|
||||
unlock=DriveLock(dv);
|
||||
unlock=DriveLock(drive);
|
||||
BlkDevInit(bd);
|
||||
if (dv->drv_offset && blk<dv->drv_offset ||
|
||||
blk+count>dv->drv_offset+dv->size)
|
||||
if (drive->drv_offset && blk<drive->drv_offset ||
|
||||
blk+count>drive->drv_offset+drive->size)
|
||||
throw('Drive');
|
||||
if (bd->flags & BDF_READ_CACHE)
|
||||
RCache(dv,&buf,&blk,&count);
|
||||
RCache(drive,&buf,&blk,&count);
|
||||
if (count>0) {
|
||||
switch (bd->type) {
|
||||
case BDT_RAM:
|
||||
MemCpy(buf,bd->RAM_dsk+blk<<BLK_SIZE_BITS,count<<BLK_SIZE_BITS);
|
||||
MemCpy(buf,bd->RAM_disk+blk<<BLK_SIZE_BITS,count<<BLK_SIZE_BITS);
|
||||
break;
|
||||
case BDT_ISO_FILE_READ:
|
||||
case BDT_ISO_FILE_WRITE:
|
||||
FBlkRead(bd->file_dsk,buf,blk,count);
|
||||
FBlkRead(bd->file_disk,buf,blk,count);
|
||||
break;
|
||||
case BDT_ATA:
|
||||
case BDT_ATAPI:
|
||||
res=ATARBlks(dv,buf,blk,count);
|
||||
res=ATARBlks(drive,buf,blk,count);
|
||||
break;
|
||||
}
|
||||
bd->last_time=tS;
|
||||
if (bd->flags & BDF_READ_CACHE)
|
||||
DiskCacheAdd(dv,buf,blk,count);
|
||||
DiskCacheAdd(drive,buf,blk,count);
|
||||
}
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
return res;
|
||||
}
|
||||
|
||||
Bool BlkWrite(CDrive *dv,U8 *buf, I64 blk, I64 count)
|
||||
Bool BlkWrite(CDrive *drive,U8 *buf, I64 blk, I64 count)
|
||||
{//Write blk count from buf to Drive.
|
||||
Bool res=TRUE,unlock;
|
||||
CBlkDev *bd=dv->bd;
|
||||
CBlkDev *bd=drive->bd;
|
||||
if (count<=0) return TRUE;
|
||||
DriveCheck(dv);
|
||||
DriveCheck(drive);
|
||||
try {
|
||||
unlock=DriveLock(dv);
|
||||
unlock=DriveLock(drive);
|
||||
BlkDevInit(bd);
|
||||
if (bd->flags&BDF_READ_ONLY && !(bd->flags & BDF_READ_ONLY_OVERRIDE))
|
||||
throw('BlkDev');
|
||||
if (dv->drv_offset && blk<dv->drv_offset ||
|
||||
blk+count>dv->drv_offset+dv->size)
|
||||
if (drive->drv_offset && blk<drive->drv_offset ||
|
||||
blk+count>drive->drv_offset+drive->size)
|
||||
throw('Drive');
|
||||
if (count>0) {
|
||||
switch (bd->type) {
|
||||
case BDT_RAM:
|
||||
MemCpy(bd->RAM_dsk+blk<<BLK_SIZE_BITS,buf,count<<BLK_SIZE_BITS);
|
||||
MemCpy(bd->RAM_disk+blk<<BLK_SIZE_BITS,buf,count<<BLK_SIZE_BITS);
|
||||
break;
|
||||
case BDT_ISO_FILE_READ:
|
||||
case BDT_ISO_FILE_WRITE:
|
||||
FBlkWrite(bd->file_dsk,buf,blk,count);
|
||||
FBlkWrite(bd->file_disk,buf,blk,count);
|
||||
break;
|
||||
case BDT_ATA:
|
||||
case BDT_ATAPI:
|
||||
res=ATAWBlks(dv,buf,blk,count);
|
||||
res=ATAWBlks(drive,buf,blk,count);
|
||||
break;
|
||||
}
|
||||
bd->last_time=tS;
|
||||
if (bd->flags & BDF_READ_CACHE)
|
||||
DiskCacheAdd(dv,buf,blk,count);
|
||||
DiskCacheAdd(drive,buf,blk,count);
|
||||
}
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
return res;
|
||||
}
|
||||
|
@ -32,38 +32,38 @@ Bool BlkDevInit(CBlkDev *bd)
|
||||
{
|
||||
CDirEntry de;
|
||||
U8 buf[STR_LEN];
|
||||
CDrive *dv=Letter2Drive(bd->first_drv_let);
|
||||
CDrive *drive=Letter2Drive(bd->first_drive_let);
|
||||
Bool res=FALSE;
|
||||
if (!LBts(&bd->flags,BDf_INITIALIZED)) {
|
||||
bd->flags|=BDF_INIT_IN_PROGRESS;
|
||||
switch (bd->type) {
|
||||
case BDT_RAM:
|
||||
if (!bd->RAM_dsk) {
|
||||
bd->RAM_dsk=AMAlloc((bd->max_blk+1)<<BLK_SIZE_BITS);
|
||||
bd->max_blk=MSize(bd->RAM_dsk)>>BLK_SIZE_BITS-1;
|
||||
if (!bd->RAM_disk) {
|
||||
bd->RAM_disk=AMAlloc((bd->max_blk+1)<<BLK_SIZE_BITS);
|
||||
bd->max_blk=MSize(bd->RAM_disk)>>BLK_SIZE_BITS-1;
|
||||
}
|
||||
dv->fs_type=FSt_REDSEA;
|
||||
dv->size=bd->max_blk+1-bd->drv_offset;
|
||||
if (RedSeaValidate(bd->first_drv_let))
|
||||
RedSeaInit(dv);
|
||||
drive->fs_type=FSt_REDSEA;
|
||||
drive->size=bd->max_blk+1-bd->drv_offset;
|
||||
if (RedSeaValidate(bd->first_drive_let))
|
||||
RedSeaInit(drive);
|
||||
else
|
||||
RedSeaFmt(bd->first_drv_let);
|
||||
RedSeaFmt(bd->first_drive_let);
|
||||
res=TRUE;
|
||||
break;
|
||||
case BDT_ISO_FILE_READ:
|
||||
if (FileFind(bd->file_dsk_name,&de,FUF_JUST_FILES)) {
|
||||
if (FileFind(bd->file_disk_name,&de,FUF_JUST_FILES)) {
|
||||
bd->max_blk=de.size>>BLK_SIZE_BITS-1;
|
||||
try bd->file_dsk=FOpen(bd->file_dsk_name,"rc",bd->max_blk+1);
|
||||
try bd->file_disk=FOpen(bd->file_disk_name,"rc",bd->max_blk+1);
|
||||
catch {
|
||||
if (Fs->except_ch=='File')
|
||||
PrintErr("Not Contiguous.Move file to filename.ISO.C.\n");
|
||||
Fs->catch_except=TRUE;
|
||||
}
|
||||
if (bd->file_dsk) {
|
||||
dv->fs_type=FSt_REDSEA;
|
||||
dv->size=bd->max_blk+1-bd->drv_offset;
|
||||
if (RedSeaValidate(bd->first_drv_let)) {
|
||||
RedSeaInit(dv);
|
||||
if (bd->file_disk) {
|
||||
drive->fs_type=FSt_REDSEA;
|
||||
drive->size=bd->max_blk+1-bd->drv_offset;
|
||||
if (RedSeaValidate(bd->first_drive_let)) {
|
||||
RedSeaInit(drive);
|
||||
res=TRUE;
|
||||
} else
|
||||
PrintErr("Not RedSea\n");
|
||||
@ -71,18 +71,18 @@ Bool BlkDevInit(CBlkDev *bd)
|
||||
}
|
||||
break;
|
||||
case BDT_ISO_FILE_WRITE:
|
||||
if (!bd->file_dsk_name) {
|
||||
if (!bd->file_disk_name) {
|
||||
StrPrint(buf,"%C:/Drive%C.ISO.C",
|
||||
blkdev.boot_drv_let,bd->first_drv_let);
|
||||
bd->file_dsk_name=AStrNew(buf);
|
||||
blkdev.boot_drive_let,bd->first_drive_let);
|
||||
bd->file_disk_name=AStrNew(buf);
|
||||
}
|
||||
if (bd->max_blk<7)
|
||||
bd->max_blk=7;
|
||||
bd->file_dsk=FOpen(bd->file_dsk_name,"wc",bd->max_blk+1);
|
||||
dv->fs_type=FSt_REDSEA;
|
||||
dv->size=bd->max_blk+1-bd->drv_offset;
|
||||
RedSeaFmt(bd->first_drv_let);
|
||||
CallExtStr("RedSeaISO9660",bd->file_dsk_name,bd->first_drv_let);
|
||||
bd->file_disk=FOpen(bd->file_disk_name,"wc",bd->max_blk+1);
|
||||
drive->fs_type=FSt_REDSEA;
|
||||
drive->size=bd->max_blk+1-bd->drv_offset;
|
||||
RedSeaFmt(bd->first_drive_let);
|
||||
CallExtStr("RedSeaISO9660",bd->file_disk_name,bd->first_drive_let);
|
||||
res=TRUE;
|
||||
break;
|
||||
case BDT_ATA:
|
||||
@ -100,11 +100,11 @@ Bool BlkDevInit(CBlkDev *bd)
|
||||
bd->max_reads=128;
|
||||
bd->max_writes=0xFFFF*4;
|
||||
if (res=ATAInit(bd))
|
||||
dv->size=bd->max_blk+1;
|
||||
drive->size=bd->max_blk+1;
|
||||
break;
|
||||
}
|
||||
if (res && bd->flags & BDF_READ_CACHE)
|
||||
DiskCacheInvalidate(dv);
|
||||
DiskCacheInvalidate(drive);
|
||||
bd->flags&=~BDF_INIT_IN_PROGRESS;
|
||||
} else
|
||||
res=TRUE;
|
||||
@ -122,17 +122,17 @@ U0 BlkDevsRelease()
|
||||
}
|
||||
}
|
||||
|
||||
CBlkDev *BlkDevNextFreeSlot(U8 first_drv_let,I64 type)
|
||||
CBlkDev *BlkDevNextFreeSlot(U8 first_drive_let,I64 type)
|
||||
{//Locate free slot for new BlkDev, like during $LK,"Mount",A="MN:Mount"$().
|
||||
I64 i=0;
|
||||
CBlkDev *res;
|
||||
if (Letter2BlkDevType(first_drv_let)!=type)
|
||||
if (Letter2BlkDevType(first_drive_let)!=type)
|
||||
throw('BlkDev');
|
||||
do {
|
||||
res=&blkdev.blkdevs[i];
|
||||
if (res->bd_signature!=BD_SIGNATURE_VAL) {
|
||||
MemSet(res,0,sizeof(CBlkDev));
|
||||
res->first_drv_let=first_drv_let;
|
||||
res->first_drive_let=first_drive_let;
|
||||
res->type=type;
|
||||
res->flags=BDF_READ_CACHE;
|
||||
res->blk_size=BLK_SIZE;
|
||||
@ -159,8 +159,8 @@ CBlkDev *BlkDevNextFreeSlot(U8 first_drv_let,I64 type)
|
||||
U0 BlkDevDel(CBlkDev *bd)
|
||||
{//Delete BlkDev
|
||||
DriveBlkDevDel(bd);
|
||||
FClose(bd->file_dsk);
|
||||
Free(bd->file_dsk_name);
|
||||
FClose(bd->file_disk);
|
||||
Free(bd->file_disk_name);
|
||||
Free(bd->dev_id_record);
|
||||
MemSet(bd,0,sizeof(CBlkDev));
|
||||
}
|
||||
@ -179,9 +179,9 @@ CBlkDev *BlkDevCheck(CBlkDev *bd,Bool except=TRUE)
|
||||
|
||||
CBlkDev *Letter2BlkDev(U8 drv_let=0,Bool except=TRUE)
|
||||
{//Drive letter to BlkDev ptr.
|
||||
CDrive *dv;
|
||||
if (dv=Letter2Drive(drv_let,except))
|
||||
return BlkDevCheck(dv->bd,except);
|
||||
CDrive *drive;
|
||||
if (drive=Letter2Drive(drv_let,except))
|
||||
return BlkDevCheck(drive->bd,except);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
Bool ISOInit(CDrive *dv,I64 blk)
|
||||
Bool ISOInit(CDrive *drive,I64 blk)
|
||||
{
|
||||
CBlkDev *bd=dv->bd;
|
||||
CBlkDev *bd=drive->bd;
|
||||
I64 spc=bd->blk_size>>BLK_SIZE_BITS,i=blk/spc,drv_offset=0;
|
||||
CISOPriDesc *iso=MAlloc(bd->blk_size);
|
||||
CISODirEntry *de;
|
||||
@ -8,13 +8,13 @@ Bool ISOInit(CDrive *dv,I64 blk)
|
||||
U8 buf[8];
|
||||
|
||||
try {
|
||||
unlock=DriveLock(dv);
|
||||
dv->fs_type=FSt_ISO9660;
|
||||
dv->spc=spc;
|
||||
dv->data_area=dv->root_clus=dv->drv_offset=bd->drv_offset=dv->size=0;
|
||||
unlock=DriveLock(drive);
|
||||
drive->fs_type=FSt_ISO9660;
|
||||
drive->spc=spc;
|
||||
drive->data_area=drive->root_clus=drive->drv_offset=bd->drv_offset=drive->size=0;
|
||||
while (TRUE) {
|
||||
dv->size=MaxI64(dv->size,(i+1)*spc);
|
||||
BlkRead(dv,iso,i*spc,spc);
|
||||
drive->size=MaxI64(drive->size,(i+1)*spc);
|
||||
BlkRead(drive,iso,i*spc,spc);
|
||||
buf[0](U32)=iso->id[0](U32);
|
||||
buf[4](U16)=iso->id[4](U8);
|
||||
switch (ListMatch(buf,"CD001\0CDW02\0BEA01\0BOOT2\0NSR02\0NSR03\0TEA01\0",
|
||||
@ -26,15 +26,15 @@ Bool ISOInit(CDrive *dv,I64 blk)
|
||||
break;
|
||||
case ISOT_SUPPLEMENTARY_DESC:
|
||||
de=&iso->root_dir_record;
|
||||
dv->size=iso->vol_space_size.little*bd->blk_size>>BLK_SIZE_BITS;
|
||||
drive->size=iso->vol_space_size.little*bd->blk_size>>BLK_SIZE_BITS;
|
||||
if (!StrCmp(iso->publisher_id,"ZenithOS RedSea")) {
|
||||
dv->fs_type=FSt_REDSEA;
|
||||
bd->drv_offset=dv->drv_offset=19<<2+drv_offset;
|
||||
bd->max_blk=dv->size-1;
|
||||
dv->size-=bd->drv_offset;
|
||||
RedSeaInit(dv);
|
||||
drive->fs_type=FSt_REDSEA;
|
||||
bd->drv_offset=drive->drv_offset=19<<2+drv_offset;
|
||||
bd->max_blk=drive->size-1;
|
||||
drive->size-=bd->drv_offset;
|
||||
RedSeaInit(drive);
|
||||
} else
|
||||
dv->root_clus=de->loc.little;
|
||||
drive->root_clus=de->loc.little;
|
||||
res=TRUE;
|
||||
goto di_done;
|
||||
case ISOT_TERMINATOR:
|
||||
@ -50,22 +50,22 @@ Bool ISOInit(CDrive *dv,I64 blk)
|
||||
di_done:
|
||||
Free(iso);
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch {
|
||||
dv->fs_type=FSt_ISO9660;
|
||||
dv->spc=spc;
|
||||
dv->drv_offset=bd->drv_offset=dv->data_area=dv->root_clus=0;
|
||||
drive->fs_type=FSt_ISO9660;
|
||||
drive->spc=spc;
|
||||
drive->drv_offset=bd->drv_offset=drive->data_area=drive->root_clus=0;
|
||||
Free(iso);
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 DVDImageRead(U8 dvd_drv_let,U8 *out_name)
|
||||
U0 DVDImageRead(U8 dvd_drive_let,U8 *out_name)
|
||||
{//Read entire CD/DVD image into ISO file.
|
||||
CDrive *dv=Letter2Drive(dvd_drv_let);
|
||||
CBlkDev *bd=dv->bd;
|
||||
CDrive *drive=Letter2Drive(dvd_drive_let);
|
||||
CBlkDev *bd=drive->bd;
|
||||
U8 *buf=MAlloc(COPY_BUF_BLKS<<BLK_SIZE_BITS),
|
||||
*out_name2=ExtDefault(out_name,"ISO");
|
||||
CFile *f=FOpen(out_name2,"w");
|
||||
@ -75,7 +75,7 @@ U0 DVDImageRead(U8 dvd_drv_let,U8 *out_name)
|
||||
throw('BlkDev');
|
||||
if (!out_name)
|
||||
out_name=blkdev.default_iso_filename;
|
||||
count=CeilU64(dv->size,spc);
|
||||
count=CeilU64(drive->size,spc);
|
||||
while (count>0) {
|
||||
if (count>COPY_BUF_BLKS)
|
||||
n=COPY_BUF_BLKS;
|
||||
@ -140,13 +140,13 @@ U0 DVDImageWriteTask(CDualBuf *d)
|
||||
FClose(f);
|
||||
}
|
||||
|
||||
U0 DVDImageWrite(U8 dvd_drv_let,U8 *in_name=NULL,I64 media_type=MT_DVD)
|
||||
U0 DVDImageWrite(U8 dvd_drive_let,U8 *in_name=NULL,I64 media_type=MT_DVD)
|
||||
{//Write CD/DVD ISO file to disk.
|
||||
CDualBuf *d=CAlloc(sizeof(CDualBuf));
|
||||
U8 *buf,*in_name2,*in_name3;
|
||||
I64 i,n,spc,blk=0,count;
|
||||
CDrive *dv=Letter2Drive(dvd_drv_let);
|
||||
CBlkDev *bd=dv->bd,*bd2;
|
||||
CDrive *drive=Letter2Drive(dvd_drive_let);
|
||||
CBlkDev *bd=drive->bd,*bd2;
|
||||
CTask *task;
|
||||
CFile *f;
|
||||
|
||||
@ -175,8 +175,8 @@ U0 DVDImageWrite(U8 dvd_drv_let,U8 *in_name=NULL,I64 media_type=MT_DVD)
|
||||
bd->flags|=BDF_READ_ONLY_OVERRIDE;
|
||||
BlkDevInit(bd);
|
||||
spc=bd->blk_size>>BLK_SIZE_BITS;
|
||||
if (dv->size<count)
|
||||
dv->size=count;
|
||||
if (drive->size<count)
|
||||
drive->size=count;
|
||||
|
||||
d->filename=in_name2;
|
||||
d->dvd_bd=bd;
|
||||
|
@ -22,16 +22,16 @@ CFile *FOpen(U8 *filename,U8 *flags,I64 count=0)
|
||||
f->max_blk=I64_MAX;
|
||||
f->file_clus_num=INVALID_CLUS;
|
||||
full_name=FileNameAbs(filename);
|
||||
f->dv=Letter2Drive(*full_name);
|
||||
if (f->dv->fs_type==FSt_REDSEA)
|
||||
f->drive=Letter2Drive(*full_name);
|
||||
if (f->drive->fs_type==FSt_REDSEA)
|
||||
contiguous=TRUE;
|
||||
if (contiguous) {
|
||||
f->flags|=FF_CONTIGUOUS;
|
||||
if (f->dv->fs_type!=FSt_REDSEA &&
|
||||
if (f->drive->fs_type!=FSt_REDSEA &&
|
||||
!(FileAttr(filename) & RS_ATTR_CONTIGUOUS))
|
||||
throw('File');
|
||||
}
|
||||
f->clus_buf=CAlloc(f->dv->spc<<BLK_SIZE_BITS);
|
||||
f->clus_buf=CAlloc(f->drive->spc<<BLK_SIZE_BITS);
|
||||
if (StrOcc(flags,'w')) {
|
||||
f->flags=f->flags|FF_WRITE|FF_NEEDS_WRITE;
|
||||
if (StrOcc(flags,'+')) {
|
||||
@ -48,10 +48,10 @@ CFile *FOpen(U8 *filename,U8 *flags,I64 count=0)
|
||||
if (dirc=DirContextNew(full_name)) {
|
||||
StrCpy(f->de.name,dirc->mask);
|
||||
if (count>0) {//We pre-alloc the whole thing.
|
||||
f->de.clus=ClusAlloc(f->dv,0,
|
||||
(count+f->dv->spc-1)/f->dv->spc,contiguous);
|
||||
f->de.clus=ClusAlloc(f->drive,0,
|
||||
(count+f->drive->spc-1)/f->drive->spc,contiguous);
|
||||
f->de.size=count<<BLK_SIZE_BITS;
|
||||
DirNew(dirc->dv,Fs->cur_dir,&f->de,TRUE);
|
||||
DirNew(dirc->drive,Fs->cur_dir,&f->de,TRUE);
|
||||
f->flags&=~FF_NEW_FILE;
|
||||
}
|
||||
DirContextDel(dirc);
|
||||
@ -75,7 +75,7 @@ U0 FClose(CFile *f)
|
||||
CDirContext *dirc;
|
||||
if (f) {
|
||||
if (f->flags & FF_BUF_DIRTY) {
|
||||
ClusWrite(f->dv,f->clus_buf,f->clus,1);
|
||||
ClusWrite(f->drive,f->clus_buf,f->clus,1);
|
||||
f->flags&=~FF_BUF_DIRTY;
|
||||
}
|
||||
if (f->flags & FF_NEEDS_WRITE) {
|
||||
@ -83,9 +83,9 @@ U0 FClose(CFile *f)
|
||||
if (!(f->flags & FF_USE_OLD_DATETIME))
|
||||
f->de.datetime=Now;
|
||||
if (f->flags & FF_NEW_FILE)
|
||||
DirNew(dirc->dv,Fs->cur_dir,&f->de,TRUE);
|
||||
DirNew(dirc->drive,Fs->cur_dir,&f->de,TRUE);
|
||||
else
|
||||
DirNew(dirc->dv,Fs->cur_dir,&f->de,FALSE);
|
||||
DirNew(dirc->drive,Fs->cur_dir,&f->de,FALSE);
|
||||
DirContextDel(dirc);
|
||||
} else
|
||||
throw('File');
|
||||
@ -98,29 +98,29 @@ U0 FClose(CFile *f)
|
||||
|
||||
I64 FSetClus(CFile *f,I64 c,I64 blk,Bool read)
|
||||
{
|
||||
CDrive *dv=f->dv;
|
||||
CDrive *drive=f->drive;
|
||||
I64 i;
|
||||
if (f->clus!=c) {
|
||||
if (f->flags & FF_BUF_DIRTY) {
|
||||
i=dv->spc;
|
||||
i=drive->spc;
|
||||
if (f->max_blk!=I64_MAX) {
|
||||
i=f->max_blk+1-f->file_clus_num*dv->spc;
|
||||
if (i>dv->spc)
|
||||
i=dv->spc;
|
||||
i=f->max_blk+1-f->file_clus_num*drive->spc;
|
||||
if (i>drive->spc)
|
||||
i=drive->spc;
|
||||
}
|
||||
ClusBlkWrite(dv,f->clus_buf,f->clus,i);
|
||||
ClusBlkWrite(drive,f->clus_buf,f->clus,i);
|
||||
f->flags=f->flags & ~FF_BUF_DIRTY;
|
||||
}
|
||||
f->clus=c;
|
||||
f->file_clus_num=blk/dv->spc;
|
||||
f->file_clus_num=blk/drive->spc;
|
||||
if (read) {
|
||||
i=dv->spc;
|
||||
i=drive->spc;
|
||||
if (f->max_blk!=I64_MAX) {
|
||||
i=f->max_blk+1-f->file_clus_num*dv->spc;
|
||||
if (i>dv->spc)
|
||||
i=dv->spc;
|
||||
i=f->max_blk+1-f->file_clus_num*drive->spc;
|
||||
if (i>drive->spc)
|
||||
i=drive->spc;
|
||||
}
|
||||
c=ClusBlkRead(dv,f->clus_buf,c,i);
|
||||
c=ClusBlkRead(drive,f->clus_buf,c,i);
|
||||
}
|
||||
}
|
||||
return c;
|
||||
@ -128,9 +128,9 @@ I64 FSetClus(CFile *f,I64 c,I64 blk,Bool read)
|
||||
|
||||
Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 count=1)
|
||||
{//Read [nth,n+count) blks of file.
|
||||
CDrive *dv=f->dv;
|
||||
I64 spc=dv->spc,i,j,c=f->de.clus;
|
||||
if (!f || !dv) return FALSE;
|
||||
CDrive *drive=f->drive;
|
||||
I64 spc=drive->spc,i,j,c=f->de.clus;
|
||||
if (!f || !drive) return FALSE;
|
||||
if (blk==FFB_NEXT_BLK)
|
||||
blk=f->fblk_num;
|
||||
if (blk+count-1>f->max_blk)
|
||||
@ -138,7 +138,7 @@ Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 count=1)
|
||||
if (count<=0) return TRUE;
|
||||
|
||||
if (f->flags & FF_CONTIGUOUS) {
|
||||
BlkRead(dv,buf,Clus2Blk(dv,c)+blk,count);
|
||||
BlkRead(drive,buf,Clus2Blk(drive,c)+blk,count);
|
||||
blk+=count;
|
||||
} else {
|
||||
i=blk/spc;
|
||||
@ -147,7 +147,7 @@ Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 count=1)
|
||||
i-=f->file_clus_num;
|
||||
}
|
||||
if (i>0)
|
||||
c=ClusNumNext(dv,c,i);
|
||||
c=ClusNumNext(drive,c,i);
|
||||
|
||||
if (i=blk%spc) {
|
||||
c=FSetClus(f,c,blk,TRUE);
|
||||
@ -180,9 +180,9 @@ Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 count=1)
|
||||
|
||||
Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 count=1)
|
||||
{//Write [nth,n+count) blks of file.
|
||||
CDrive *dv=f->dv;
|
||||
I64 spc=dv->spc,i,j,c=f->de.clus,c1;
|
||||
if (!f || !dv) return FALSE;
|
||||
CDrive *drive=f->drive;
|
||||
I64 spc=drive->spc,i,j,c=f->de.clus,c1;
|
||||
if (!f || !drive) return FALSE;
|
||||
if (blk==FFB_NEXT_BLK)
|
||||
blk=f->fblk_num;
|
||||
if (blk+count-1>f->max_blk)
|
||||
@ -191,11 +191,11 @@ Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 count=1)
|
||||
return FALSE;
|
||||
if (count<=0) return TRUE;
|
||||
if (f->flags & FF_CONTIGUOUS) {
|
||||
BlkWrite(dv,buf,Clus2Blk(dv,c)+blk,count);
|
||||
BlkWrite(drive,buf,Clus2Blk(drive,c)+blk,count);
|
||||
blk+=count;
|
||||
} else {
|
||||
if (!c) {
|
||||
c=ClusAlloc(dv,0,1,FALSE);
|
||||
c=ClusAlloc(drive,0,1,FALSE);
|
||||
f->file_clus_num=0;
|
||||
f->clus=c;
|
||||
f->de.clus=c;
|
||||
@ -208,11 +208,11 @@ Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 count=1)
|
||||
}
|
||||
while (i>0) {
|
||||
c1=c;
|
||||
c=ClusNumNext(dv,c1,1);
|
||||
c=ClusNumNext(drive,c1,1);
|
||||
if (c==INVALID_CLUS) {
|
||||
c=ClusAlloc(dv,c1,i,FALSE);
|
||||
c=ClusAlloc(drive,c1,i,FALSE);
|
||||
if (i>1)
|
||||
c=ClusNumNext(dv,c,i-1);
|
||||
c=ClusNumNext(drive,c,i-1);
|
||||
break;
|
||||
} else
|
||||
i--;
|
||||
@ -231,9 +231,9 @@ Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 count=1)
|
||||
blk+=j;
|
||||
if (count>0) {
|
||||
c1=c;
|
||||
c=ClusNumNext(dv,c1,1);
|
||||
c=ClusNumNext(drive,c1,1);
|
||||
if (c==INVALID_CLUS)
|
||||
c=ClusAlloc(dv,c1,1,FALSE);
|
||||
c=ClusAlloc(drive,c1,1,FALSE);
|
||||
}
|
||||
}
|
||||
while (count>=spc) {
|
||||
@ -245,9 +245,9 @@ Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 count=1)
|
||||
blk+=spc;
|
||||
if (count>0) {
|
||||
c1=c;
|
||||
c=ClusNumNext(dv,c1,1);
|
||||
c=ClusNumNext(drive,c1,1);
|
||||
if (c==INVALID_CLUS)
|
||||
c=ClusAlloc(dv,c1,1,FALSE);
|
||||
c=ClusAlloc(drive,c1,1,FALSE);
|
||||
}
|
||||
}
|
||||
if (count>0) {
|
||||
|
@ -3,7 +3,7 @@ U0 DiskCacheInit(I64 size_in_U8s)
|
||||
CCacheBlk *tmpc;
|
||||
I64 i,count;
|
||||
|
||||
while (LBts(&sys_semas[SEMA_DSK_CACHE],0))
|
||||
while (LBts(&sys_semas[SEMA_DISK_CACHE],0))
|
||||
Yield;
|
||||
Free(blkdev.cache_ctrl);
|
||||
Free(blkdev.cache_base);
|
||||
@ -23,23 +23,23 @@ U0 DiskCacheInit(I64 size_in_U8s)
|
||||
tmpc=blkdev.cache_base+i;
|
||||
QueueInsert(tmpc,blkdev.cache_ctrl->last_lru);
|
||||
tmpc->next_hash=tmpc->last_hash=tmpc;
|
||||
tmpc->dv=NULL;
|
||||
tmpc->drive=NULL;
|
||||
tmpc->blk=0;
|
||||
}
|
||||
|
||||
blkdev.cache_hash_table=AMAlloc(DSK_CACHE_HASH_SIZE*sizeof(U8 *)*2);
|
||||
for (i=0;i<DSK_CACHE_HASH_SIZE;i++) {
|
||||
blkdev.cache_hash_table=AMAlloc(DISK_CACHE_HASH_SIZE*sizeof(U8 *)*2);
|
||||
for (i=0;i<DISK_CACHE_HASH_SIZE;i++) {
|
||||
tmpc=blkdev.cache_hash_table(U8 *)+i*sizeof(U8 *)*2
|
||||
-offset(CCacheBlk.next_hash);
|
||||
tmpc->next_hash=tmpc->last_hash=tmpc;
|
||||
}
|
||||
}
|
||||
LBtr(&sys_semas[SEMA_DSK_CACHE],0);
|
||||
LBtr(&sys_semas[SEMA_DISK_CACHE],0);
|
||||
}
|
||||
|
||||
I64 DiskCacheHash(I64 blk)
|
||||
{
|
||||
I64 i=blk & (DSK_CACHE_HASH_SIZE-1);
|
||||
I64 i=blk & (DISK_CACHE_HASH_SIZE-1);
|
||||
return blkdev.cache_hash_table(U8 *)+i<<4-offset(CCacheBlk.next_hash);
|
||||
}
|
||||
|
||||
@ -61,70 +61,70 @@ U0 DiskCacheQueueIns(CCacheBlk *tmpc)
|
||||
tmp_l->next_hash=tmp_n->last_hash=tmpc;
|
||||
}
|
||||
|
||||
CCacheBlk *DiskCacheFind(CDrive *dv,I64 blk)
|
||||
CCacheBlk *DiskCacheFind(CDrive *drive,I64 blk)
|
||||
{
|
||||
CCacheBlk *tmpc,*tmpc1=DiskCacheHash(blk);
|
||||
tmpc=tmpc1->next_hash;
|
||||
while (tmpc!=tmpc1) {
|
||||
if (tmpc->dv==dv && tmpc->blk==blk)
|
||||
if (tmpc->drive==drive && tmpc->blk==blk)
|
||||
return tmpc;
|
||||
tmpc=tmpc->next_hash;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
U0 DiskCacheAdd(CDrive *dv,U8 *buf, I64 blk, I64 count)
|
||||
U0 DiskCacheAdd(CDrive *drive,U8 *buf, I64 blk, I64 count)
|
||||
{
|
||||
CCacheBlk *tmpc;
|
||||
if (blkdev.cache_base) {
|
||||
while (LBts(&sys_semas[SEMA_DSK_CACHE],0))
|
||||
while (LBts(&sys_semas[SEMA_DISK_CACHE],0))
|
||||
Yield;
|
||||
while (count-->0) {
|
||||
if (!(tmpc=DiskCacheFind(dv,blk)))
|
||||
if (!(tmpc=DiskCacheFind(drive,blk)))
|
||||
tmpc=blkdev.cache_ctrl->next_lru;
|
||||
DiskCacheQueueRemove(tmpc);
|
||||
MemCpy(&tmpc->body,buf,BLK_SIZE);
|
||||
tmpc->dv=dv;
|
||||
tmpc->drive=drive;
|
||||
tmpc->blk=blk;
|
||||
DiskCacheQueueIns(tmpc);
|
||||
blk++;
|
||||
buf+=BLK_SIZE;
|
||||
}
|
||||
LBtr(&sys_semas[SEMA_DSK_CACHE],0);
|
||||
LBtr(&sys_semas[SEMA_DISK_CACHE],0);
|
||||
}
|
||||
}
|
||||
|
||||
U0 DiskCacheInvalidate2(CDrive *dv)
|
||||
U0 DiskCacheInvalidate2(CDrive *drive)
|
||||
{
|
||||
CCacheBlk *tmpc,*tmpc1;
|
||||
if (blkdev.cache_base) {
|
||||
while (LBts(&sys_semas[SEMA_DSK_CACHE],0))
|
||||
while (LBts(&sys_semas[SEMA_DISK_CACHE],0))
|
||||
Yield;
|
||||
tmpc=blkdev.cache_ctrl->last_lru;
|
||||
while (tmpc!=blkdev.cache_ctrl) {
|
||||
tmpc1=tmpc->last_lru;
|
||||
if (tmpc->dv==dv) {
|
||||
if (tmpc->drive==drive) {
|
||||
DiskCacheQueueRemove(tmpc);
|
||||
tmpc->dv=NULL;
|
||||
tmpc->drive=NULL;
|
||||
tmpc->blk=0;
|
||||
tmpc->next_hash=tmpc->last_hash=tmpc;
|
||||
QueueInsert(tmpc,blkdev.cache_ctrl->last_lru);
|
||||
}
|
||||
tmpc=tmpc1;
|
||||
}
|
||||
LBtr(&sys_semas[SEMA_DSK_CACHE],0);
|
||||
LBtr(&sys_semas[SEMA_DISK_CACHE],0);
|
||||
}
|
||||
}
|
||||
|
||||
U0 RCache(CDrive *dv,U8 **_buf, I64 *_blk, I64 *_count)
|
||||
U0 RCache(CDrive *drive,U8 **_buf, I64 *_blk, I64 *_count)
|
||||
{
|
||||
CCacheBlk *tmpc;
|
||||
if (blkdev.cache_base) {
|
||||
while (LBts(&sys_semas[SEMA_DSK_CACHE],0))
|
||||
while (LBts(&sys_semas[SEMA_DISK_CACHE],0))
|
||||
Yield;
|
||||
//fetch leading blks from cache
|
||||
while (*_count>0) {
|
||||
if (tmpc=DiskCacheFind(dv,*_blk)) {
|
||||
if (tmpc=DiskCacheFind(drive,*_blk)) {
|
||||
MemCpy(*_buf,&tmpc->body,BLK_SIZE);
|
||||
*_count-=1;
|
||||
*_buf+=BLK_SIZE;
|
||||
@ -134,12 +134,12 @@ U0 RCache(CDrive *dv,U8 **_buf, I64 *_blk, I64 *_count)
|
||||
}
|
||||
//fetch trailing blks from cache
|
||||
while (*_count>0) {
|
||||
if (tmpc=DiskCacheFind(dv,*_blk+*_count-1)) {
|
||||
if (tmpc=DiskCacheFind(drive,*_blk+*_count-1)) {
|
||||
MemCpy(*_buf+(*_count-1)<<BLK_SIZE_BITS,&tmpc->body,BLK_SIZE);
|
||||
*_count-=1;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
LBtr(&sys_semas[SEMA_DSK_CACHE],0);
|
||||
LBtr(&sys_semas[SEMA_DISK_CACHE],0);
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
I64 ClusNumNext(CDrive *dv,I64 c,I64 count=1)
|
||||
I64 ClusNumNext(CDrive *drive,I64 c,I64 count=1)
|
||||
{//Return next count'th clus in chain.
|
||||
Bool unlock;
|
||||
DriveCheck(dv);
|
||||
DriveCheck(drive);
|
||||
if (count<=0) return c;
|
||||
try {
|
||||
unlock=DriveLock(dv);
|
||||
switch (dv->fs_type) {
|
||||
unlock=DriveLock(drive);
|
||||
switch (drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
c+=count;
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
while (count-->0 && 0<c<0x0FFFFFF8) {
|
||||
DriveFATBlkSet(dv,c);
|
||||
c=dv->cur_fat_blk[c & (BLK_SIZE/4-1)];
|
||||
DriveFATBlkSet(drive,c);
|
||||
c=drive->cur_fat_blk[c & (BLK_SIZE/4-1)];
|
||||
}
|
||||
if (!(0<c<0x0FFFFFF8))
|
||||
c=INVALID_CLUS;
|
||||
@ -21,47 +21,47 @@ I64 ClusNumNext(CDrive *dv,I64 c,I64 count=1)
|
||||
throw('Drive');
|
||||
}
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
return c;
|
||||
}
|
||||
|
||||
I64 Clus2Blk(CDrive *dv,I64 c)
|
||||
I64 Clus2Blk(CDrive *drive,I64 c)
|
||||
{//Drive clus num to blk num.
|
||||
DriveCheck(dv);
|
||||
switch (dv->fs_type) {
|
||||
DriveCheck(drive);
|
||||
switch (drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
return c;
|
||||
case FSt_FAT32:
|
||||
return dv->data_area+c*dv->spc;
|
||||
return drive->data_area+c*drive->spc;
|
||||
default:
|
||||
throw('Drive');
|
||||
}
|
||||
}
|
||||
|
||||
I64 ClusBlkRead(CDrive *dv,U8 *buf,I64 c,I64 blks)
|
||||
I64 ClusBlkRead(CDrive *drive,U8 *buf,I64 c,I64 blks)
|
||||
{//Accepts blk count, so padding on last clus is not read.
|
||||
I64 i;
|
||||
Bool unlock;
|
||||
DriveCheck(dv);
|
||||
DriveCheck(drive);
|
||||
if (blks<=0) return c;
|
||||
try {
|
||||
unlock=DriveLock(dv);
|
||||
switch (dv->fs_type) {
|
||||
unlock=DriveLock(drive);
|
||||
switch (drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
BlkRead(dv,buf,c,blks);
|
||||
BlkRead(drive,buf,c,blks);
|
||||
c+=blks;
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
while (blks && 0<c<0x0FFFFFF8) {
|
||||
i=blks;
|
||||
if (i>dv->spc)
|
||||
i=dv->spc;
|
||||
BlkRead(dv,buf,dv->data_area+c*dv->spc,i);
|
||||
if (i>drive->spc)
|
||||
i=drive->spc;
|
||||
BlkRead(drive,buf,drive->data_area+c*drive->spc,i);
|
||||
buf+=i<<BLK_SIZE_BITS;
|
||||
c=ClusNumNext(dv,c,1);
|
||||
c=ClusNumNext(drive,c,1);
|
||||
blks-=i;
|
||||
}
|
||||
if (blks)
|
||||
@ -71,29 +71,29 @@ I64 ClusBlkRead(CDrive *dv,U8 *buf,I64 c,I64 blks)
|
||||
throw('Drive');
|
||||
}
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
return c;
|
||||
}
|
||||
|
||||
I64 ClusRead(CDrive *dv,U8 *buf,I64 c,I64 count)
|
||||
I64 ClusRead(CDrive *drive,U8 *buf,I64 c,I64 count)
|
||||
{//Read clus count from drv to buf.
|
||||
return ClusBlkRead(dv,buf,c,count*dv->spc);
|
||||
return ClusBlkRead(drive,buf,c,count*drive->spc);
|
||||
}
|
||||
|
||||
I64 ClusBlkWrite(CDrive *dv,U8 *buf,I64 c,I64 blks)
|
||||
I64 ClusBlkWrite(CDrive *drive,U8 *buf,I64 c,I64 blks)
|
||||
{//Accepts blk count, so padding on last clus is not written.
|
||||
I64 i;
|
||||
Bool unlock;
|
||||
DriveCheck(dv);
|
||||
DriveCheck(drive);
|
||||
if (blks<=0) return c;
|
||||
try {
|
||||
unlock=DriveLock(dv);
|
||||
switch (dv->fs_type) {
|
||||
unlock=DriveLock(drive);
|
||||
switch (drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
BlkWrite(dv,buf,c,blks);
|
||||
BlkWrite(drive,buf,c,blks);
|
||||
c=0;
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
@ -101,11 +101,11 @@ I64 ClusBlkWrite(CDrive *dv,U8 *buf,I64 c,I64 blks)
|
||||
if (!(0<c<0x0FFFFFF8))
|
||||
throw('Drive');
|
||||
i=blks;
|
||||
if (i>dv->spc)
|
||||
i=dv->spc;
|
||||
BlkWrite(dv,buf,dv->data_area+c*dv->spc,i);
|
||||
if (i>drive->spc)
|
||||
i=drive->spc;
|
||||
BlkWrite(drive,buf,drive->data_area+c*drive->spc,i);
|
||||
buf+=i<<BLK_SIZE_BITS;
|
||||
c=ClusNumNext(dv,c);
|
||||
c=ClusNumNext(drive,c);
|
||||
blks-=i;
|
||||
}
|
||||
break;
|
||||
@ -113,32 +113,32 @@ I64 ClusBlkWrite(CDrive *dv,U8 *buf,I64 c,I64 blks)
|
||||
throw('Drive');
|
||||
}
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
return c;
|
||||
}
|
||||
|
||||
I64 ClusWrite(CDrive *dv,U8 *buf,I64 c,I64 count)
|
||||
I64 ClusWrite(CDrive *drive,U8 *buf,I64 c,I64 count)
|
||||
{//Write clus count from buf to drv.
|
||||
return ClusBlkWrite(dv,buf,c,count*dv->spc);
|
||||
return ClusBlkWrite(drive,buf,c,count*drive->spc);
|
||||
}
|
||||
|
||||
I64 ClusAlloc(CDrive *dv,I64 c=0,I64 count=1,Bool contiguous=FALSE)
|
||||
I64 ClusAlloc(CDrive *drive,I64 c=0,I64 count=1,Bool contiguous=FALSE)
|
||||
{//Alloc clus count into chain.
|
||||
//c=0 means first clus in chain
|
||||
DriveCheck(dv);
|
||||
DriveCheck(drive);
|
||||
if (count<=0) return c;
|
||||
switch (dv->fs_type) {
|
||||
switch (drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
return RedSeaAllocClus(dv,count);
|
||||
return RedSeaAllocClus(drive,count);
|
||||
case FSt_FAT32:
|
||||
if (contiguous) {
|
||||
if (c) throw('File');
|
||||
return FAT32AllocContiguousClus(dv,count);
|
||||
return FAT32AllocContiguousClus(drive,count);
|
||||
} else
|
||||
return FAT32AllocClus(dv,c,count);
|
||||
return FAT32AllocClus(drive,c,count);
|
||||
default:
|
||||
throw('Drive');
|
||||
}
|
||||
|
@ -85,13 +85,13 @@ I64 Del(U8 *files_find_mask,Bool make_mask=FALSE,
|
||||
I64 res=0;
|
||||
CDirContext *dirc;
|
||||
if (dirc=DirContextNew(files_find_mask,make_mask)) {
|
||||
switch (dirc->dv->fs_type) {
|
||||
switch (dirc->drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
res=RedSeaFilesDel(dirc->dv,Fs->cur_dir,dirc->mask,
|
||||
res=RedSeaFilesDel(dirc->drive,Fs->cur_dir,dirc->mask,
|
||||
0,del_dir,print_message);
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
res=FAT32FilesDel(dirc->dv,Fs->cur_dir,dirc->mask,
|
||||
res=FAT32FilesDel(dirc->drive,Fs->cur_dir,dirc->mask,
|
||||
0,del_dir,print_message);
|
||||
break;
|
||||
default:
|
||||
|
@ -1,10 +1,10 @@
|
||||
Bool DirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain=TRUE)
|
||||
Bool DirNew(CDrive *drive,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain=TRUE)
|
||||
{//Makes a directory entry in the directory from a $LK,"CDirEntry",A="MN:CDirEntry"$ node.
|
||||
switch (dv->fs_type) {
|
||||
switch (drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
return RedSeaDirNew(dv,cur_dir,tmpde,free_old_chain);
|
||||
return RedSeaDirNew(drive,cur_dir,tmpde,free_old_chain);
|
||||
case FSt_FAT32:
|
||||
return FAT32DirNew(dv,cur_dir,tmpde,free_old_chain);
|
||||
return FAT32DirNew(drive,cur_dir,tmpde,free_old_chain);
|
||||
default:
|
||||
PrintErr("File System Not Supported\n");
|
||||
return FALSE;
|
||||
|
@ -10,7 +10,7 @@ Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE)
|
||||
{//Change directory. Optionally, make directories, too.
|
||||
I64 maxlen,cur_dir_clus=0;
|
||||
U8 *chg_to_buf,*new_cur_dir,*buf;
|
||||
CDrive *dv;
|
||||
CDrive *drive;
|
||||
Bool res=TRUE;
|
||||
if (!dirname)
|
||||
dirname="~";
|
||||
@ -51,9 +51,9 @@ Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE)
|
||||
if (Fs->cur_dv!=Letter2Drive('~') && !Drive('~'))
|
||||
return FALSE;
|
||||
} else if (StrCmp(buf,".") && *buf) {
|
||||
dv=Fs->cur_dv;
|
||||
cur_dir_clus=Name2DirClus(dv,new_cur_dir);
|
||||
switch (dv->fs_type) {
|
||||
drive=Fs->cur_dv;
|
||||
cur_dir_clus=Name2DirClus(drive,new_cur_dir);
|
||||
switch (drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
res=RedSeaCd(buf,cur_dir_clus);
|
||||
break;
|
||||
@ -175,12 +175,12 @@ Bool DirMk(U8 *filename,I64 entry_count=0)
|
||||
"Make Directory:%s\n",filename;
|
||||
name=MStrUtil(dirc->mask,
|
||||
SUF_REM_LEADING|SUF_REM_TRAILING|SUF_REM_CTRL_CHARS);
|
||||
switch (dirc->dv->fs_type) {
|
||||
switch (dirc->drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
res=RedSeaMkDir(dirc->dv,Fs->cur_dir,name,entry_count);
|
||||
res=RedSeaMkDir(dirc->drive,Fs->cur_dir,name,entry_count);
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
res=FAT32MkDir(dirc->dv,Fs->cur_dir,name,entry_count);
|
||||
res=FAT32MkDir(dirc->drive,Fs->cur_dir,name,entry_count);
|
||||
break;
|
||||
default:
|
||||
PrintErr("File System Not Supported\n");
|
||||
|
@ -38,8 +38,8 @@ CDirContext *DirContextNew(U8 *_mask,Bool make_mask=FALSE,
|
||||
}
|
||||
if (*mask=='~' && Fs->cur_dv!=Letter2Drive('~') && !Drive('~'))
|
||||
valid=FALSE;
|
||||
dirc->dv=Fs->cur_dv;
|
||||
DriveCheck(dirc->dv);
|
||||
dirc->drive=Fs->cur_dv;
|
||||
DriveCheck(dirc->drive);
|
||||
buf=MAlloc(mask_len+2);
|
||||
StrCpy(buf,mask);
|
||||
|
||||
|
@ -1,23 +1,23 @@
|
||||
Bool DriveLock(CDrive *dv)
|
||||
Bool DriveLock(CDrive *drive)
|
||||
{//Make this task have exclusive access to drv & BlkDev.
|
||||
DriveCheck(dv);
|
||||
BlkDevLock(dv->bd);
|
||||
if (!Bt(&dv->locked_flags,DVlf_LOCKED) || dv->owning_task!=Fs) {
|
||||
while (LBts(&dv->locked_flags,DVlf_LOCKED))
|
||||
DriveCheck(drive);
|
||||
BlkDevLock(drive->bd);
|
||||
if (!Bt(&drive->locked_flags,DVlf_LOCKED) || drive->owning_task!=Fs) {
|
||||
while (LBts(&drive->locked_flags,DVlf_LOCKED))
|
||||
Yield;
|
||||
dv->owning_task=Fs;
|
||||
drive->owning_task=Fs;
|
||||
return TRUE;
|
||||
} else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Bool DriveUnlock(CDrive *dv,Bool reset=FALSE)
|
||||
Bool DriveUnlock(CDrive *drive,Bool reset=FALSE)
|
||||
{//Release exclusive lock on access to drv & BlkDev.
|
||||
DriveCheck(dv);
|
||||
if (Bt(&dv->locked_flags,DVlf_LOCKED) && dv->owning_task==Fs) {
|
||||
BlkDevUnlock(dv->bd,reset);
|
||||
dv->owning_task=NULL;
|
||||
LBtr(&dv->locked_flags,DVlf_LOCKED);
|
||||
DriveCheck(drive);
|
||||
if (Bt(&drive->locked_flags,DVlf_LOCKED) && drive->owning_task==Fs) {
|
||||
BlkDevUnlock(drive->bd,reset);
|
||||
drive->owning_task=NULL;
|
||||
LBtr(&drive->locked_flags,DVlf_LOCKED);
|
||||
Yield; //Prevent deadlock
|
||||
return TRUE;
|
||||
} else
|
||||
@ -27,11 +27,11 @@ Bool DriveUnlock(CDrive *dv,Bool reset=FALSE)
|
||||
U0 DrivesRelease()
|
||||
{//When task dies, release all owned drvs.
|
||||
I64 i;
|
||||
CDrive *dv;
|
||||
for (i=0;i<DRVS_NUM;i++) {
|
||||
dv=&blkdev.drvs[i];
|
||||
if (dv->owning_task==Fs && dv->dv_signature==DRV_SIGNATURE_VAL)
|
||||
DriveUnlock(dv,TRUE);
|
||||
CDrive *drive;
|
||||
for (i=0;i<DRIVES_NUM;i++) {
|
||||
drive=&blkdev.drvs[i];
|
||||
if (drive->owning_task==Fs && drive->drive_signature==DRIVE_SIGNATURE_VAL)
|
||||
DriveUnlock(drive,TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ CDrive *DriveMakeFreeSlot(U8 drv_let)
|
||||
//!!! drv_let is not a $LK,"remapped",A="MN:DriveMap"$ drv.
|
||||
I64 i=Letter2Letter(drv_let)-'A';
|
||||
CDrive *res;
|
||||
if (!(0<=i<DRVS_NUM))
|
||||
if (!(0<=i<DRIVES_NUM))
|
||||
throw('Drive');
|
||||
res=&blkdev.drvs[i];
|
||||
MemSet(res,0,sizeof(CDrive));
|
||||
@ -48,114 +48,114 @@ CDrive *DriveMakeFreeSlot(U8 drv_let)
|
||||
return res;
|
||||
}
|
||||
|
||||
U8 DriveNextFreeLet(U8 first_drv_let='C')
|
||||
U8 DriveNextFreeLet(U8 first_drive_let='C')
|
||||
{//Locate free slot for new drv, like during $LK,"Mount",A="MN:Mount"$().
|
||||
//!!! first_drv_let is not a $LK,"remapped",A="MN:DriveMap"$ drv.
|
||||
I64 i=Letter2Letter(first_drv_let)-'A',type=Letter2BlkDevType(first_drv_let);
|
||||
if (!(0<=i<DRVS_NUM))
|
||||
//!!! first_drive_let is not a $LK,"remapped",A="MN:DriveMap"$ drv.
|
||||
I64 i=Letter2Letter(first_drive_let)-'A',type=Letter2BlkDevType(first_drive_let);
|
||||
if (!(0<=i<DRIVES_NUM))
|
||||
throw('Drive');
|
||||
do
|
||||
if (blkdev.drvs[i].dv_signature!=DRV_SIGNATURE_VAL) {
|
||||
if (blkdev.drvs[i].drive_signature!=DRIVE_SIGNATURE_VAL) {
|
||||
if (Letter2BlkDevType(i+'A')!=type)
|
||||
throw('Drive');
|
||||
else
|
||||
return i+'A';
|
||||
}
|
||||
while (++i<DRVS_NUM);
|
||||
while (++i<DRIVES_NUM);
|
||||
throw('Drive');
|
||||
return 0; //Never gets here.
|
||||
}
|
||||
|
||||
U0 DriveDel(CDrive *dv)
|
||||
U0 DriveDel(CDrive *drive)
|
||||
{//Delete drv
|
||||
if (dv->fs_type==FSt_REDSEA && dv->next_free)
|
||||
RedSeaFreeFreeList(dv);
|
||||
Free(dv->cur_fat_blk);
|
||||
Free(dv->fis);
|
||||
MemSet(dv,0,sizeof(CDrive));
|
||||
if (drive->fs_type==FSt_REDSEA && drive->next_free)
|
||||
RedSeaFreeFreeList(drive);
|
||||
Free(drive->cur_fat_blk);
|
||||
Free(drive->fis);
|
||||
MemSet(drive,0,sizeof(CDrive));
|
||||
}
|
||||
|
||||
U0 DriveBlkDevDel(CBlkDev *bd)
|
||||
{//Delete drv's of BlkDev
|
||||
I64 i;
|
||||
CDrive *dv;
|
||||
for (i=0;i<DRVS_NUM;i++) {
|
||||
dv=&blkdev.drvs[i];
|
||||
if (dv->bd==bd)
|
||||
DriveDel(dv);
|
||||
CDrive *drive;
|
||||
for (i=0;i<DRIVES_NUM;i++) {
|
||||
drive=&blkdev.drvs[i];
|
||||
if (drive->bd==bd)
|
||||
DriveDel(drive);
|
||||
}
|
||||
}
|
||||
|
||||
U0 DriveFATBlkAlloc(CDrive *dv)
|
||||
U0 DriveFATBlkAlloc(CDrive *drive)
|
||||
{
|
||||
DriveCheck(dv);
|
||||
Free(dv->cur_fat_blk);
|
||||
dv->cur_fat_blk=AMAlloc(BLK_SIZE);
|
||||
dv->cur_fat_blk_num=0;
|
||||
dv->fat_blk_dirty=0;
|
||||
BlkRead(dv,dv->cur_fat_blk,dv->fat1,1);
|
||||
DriveCheck(drive);
|
||||
Free(drive->cur_fat_blk);
|
||||
drive->cur_fat_blk=AMAlloc(BLK_SIZE);
|
||||
drive->cur_fat_blk_num=0;
|
||||
drive->fat_blk_dirty=0;
|
||||
BlkRead(drive,drive->cur_fat_blk,drive->fat1,1);
|
||||
}
|
||||
|
||||
U0 DriveFATBlkClean(CDrive *dv,I64 fat_sel=3)
|
||||
U0 DriveFATBlkClean(CDrive *drive,I64 fat_sel=3)
|
||||
{
|
||||
if ((dv->fs_type==FSt_FAT32 || dv->fs_type==FSt_REDSEA) &&
|
||||
Bt(&dv->fat_blk_dirty,0)) {
|
||||
if (dv->fat1==dv->fat2) {
|
||||
BlkWrite(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
|
||||
LBtr(&dv->fat_blk_dirty,0);
|
||||
if ((drive->fs_type==FSt_FAT32 || drive->fs_type==FSt_REDSEA) &&
|
||||
Bt(&drive->fat_blk_dirty,0)) {
|
||||
if (drive->fat1==drive->fat2) {
|
||||
BlkWrite(drive,drive->cur_fat_blk,drive->fat1+drive->cur_fat_blk_num,1);
|
||||
LBtr(&drive->fat_blk_dirty,0);
|
||||
} else {
|
||||
if (fat_sel==3 || !fat_sel)
|
||||
BlkWrite(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
|
||||
BlkWrite(drive,drive->cur_fat_blk,drive->fat1+drive->cur_fat_blk_num,1);
|
||||
if (fat_sel==3 || fat_sel==1) {
|
||||
BlkWrite(dv,dv->cur_fat_blk,dv->fat2+dv->cur_fat_blk_num,1);
|
||||
LBtr(&dv->fat_blk_dirty,0);
|
||||
BlkWrite(drive,drive->cur_fat_blk,drive->fat2+drive->cur_fat_blk_num,1);
|
||||
LBtr(&drive->fat_blk_dirty,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U0 DriveFATBlkSet(CDrive *dv,I64 c,I64 fat_sel=3)
|
||||
U0 DriveFATBlkSet(CDrive *drive,I64 c,I64 fat_sel=3)
|
||||
{
|
||||
I64 fat_blk_num;
|
||||
if (c==INVALID_CLUS)
|
||||
throw('Drive');
|
||||
switch (dv->fs_type) {
|
||||
switch (drive->fs_type) {
|
||||
case FSt_FAT32:
|
||||
fat_blk_num=c>>(BLK_SIZE_BITS-2);
|
||||
break;
|
||||
case FSt_REDSEA:
|
||||
fat_blk_num=(c-dv->data_area)>>(BLK_SIZE_BITS+3);
|
||||
fat_blk_num=(c-drive->data_area)>>(BLK_SIZE_BITS+3);
|
||||
break;
|
||||
default:
|
||||
throw('Drive');
|
||||
}
|
||||
if (fat_blk_num!=dv->cur_fat_blk_num) {
|
||||
DriveFATBlkClean(dv,fat_sel);
|
||||
dv->cur_fat_blk_num=fat_blk_num;
|
||||
if (fat_blk_num!=drive->cur_fat_blk_num) {
|
||||
DriveFATBlkClean(drive,fat_sel);
|
||||
drive->cur_fat_blk_num=fat_blk_num;
|
||||
if (fat_sel==3 || !fat_sel)
|
||||
BlkRead(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
|
||||
BlkRead(drive,drive->cur_fat_blk,drive->fat1+drive->cur_fat_blk_num,1);
|
||||
else
|
||||
BlkRead(dv,dv->cur_fat_blk,dv->fat2+dv->cur_fat_blk_num,1);
|
||||
BlkRead(drive,drive->cur_fat_blk,drive->fat2+drive->cur_fat_blk_num,1);
|
||||
}
|
||||
}
|
||||
|
||||
CDrive *DriveCheck(CDrive *dv,Bool except=TRUE)
|
||||
CDrive *DriveCheck(CDrive *drive,Bool except=TRUE)
|
||||
{//Check for valid drv. Throw exception.
|
||||
if (!dv || dv->dv_signature!=DRV_SIGNATURE_VAL) {
|
||||
if (!drive || drive->drive_signature!=DRIVE_SIGNATURE_VAL) {
|
||||
if (except)
|
||||
throw('Drive');
|
||||
else
|
||||
return NULL;
|
||||
} else
|
||||
return dv;
|
||||
return drive;
|
||||
}
|
||||
|
||||
U8 Drive2Letter(CDrive *dv=NULL)
|
||||
U8 Drive2Letter(CDrive *drive=NULL)
|
||||
{//Drive ptr to Drive letter.
|
||||
if (!dv)
|
||||
dv=Fs->cur_dv;
|
||||
DriveCheck(dv);
|
||||
return dv->drv_let;
|
||||
if (!drive)
|
||||
drive=Fs->cur_dv;
|
||||
DriveCheck(drive);
|
||||
return drive->drv_let;
|
||||
}
|
||||
|
||||
U8 Letter2Letter(U8 drv_let=0)
|
||||
@ -163,7 +163,7 @@ U8 Letter2Letter(U8 drv_let=0)
|
||||
if (!drv_let)
|
||||
drv_let=Drive2Letter(Fs->cur_dv);
|
||||
else if (drv_let==':')
|
||||
drv_let=blkdev.boot_drv_let;
|
||||
drv_let=blkdev.boot_drive_let;
|
||||
else if (drv_let=='~')
|
||||
drv_let=*blkdev.home_dir;
|
||||
return ToUpper(drv_let);
|
||||
@ -187,9 +187,9 @@ I64 Letter2BlkDevType(U8 drv_let)
|
||||
|
||||
CDrive *Letter2Drive(U8 drv_let=0,Bool except=TRUE)
|
||||
{//Drive letter to Drive ptr.
|
||||
CDrive *dv;
|
||||
CDrive *drive;
|
||||
if (!drv_let)
|
||||
dv=Fs->cur_dv;
|
||||
drive=Fs->cur_dv;
|
||||
else {
|
||||
drv_let=Letter2Letter(drv_let);
|
||||
if (!('A'<=drv_let<='Z')) {
|
||||
@ -198,9 +198,9 @@ CDrive *Letter2Drive(U8 drv_let=0,Bool except=TRUE)
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
dv=blkdev.let_to_drv[drv_let-'A'];
|
||||
drive=blkdev.let_to_drive[drv_let-'A'];
|
||||
}
|
||||
return DriveCheck(dv,except);
|
||||
return DriveCheck(drive,except);
|
||||
}
|
||||
|
||||
CBlkDev *DriveIsWritable(U8 drv_let=0,Bool except=FALSE)
|
||||
@ -215,46 +215,46 @@ CBlkDev *DriveIsWritable(U8 drv_let=0,Bool except=FALSE)
|
||||
return bd;
|
||||
}
|
||||
|
||||
U0 DiskCacheInvalidate(CDrive *dv)
|
||||
{//Needed for removable media. Called by $LK,"DiskChg",A="MN:DiskChg"$().
|
||||
U0 DiskCacheInvalidate(CDrive *drive)
|
||||
{//Needed for removable media. Called by $LK,"DiskChange",A="MN:DiskChange"$().
|
||||
Bool unlock;
|
||||
CBlkDev *bd=dv->bd;
|
||||
DriveCheck(dv);
|
||||
CBlkDev *bd=drive->bd;
|
||||
DriveCheck(drive);
|
||||
try {
|
||||
unlock=DriveLock(dv);
|
||||
unlock=DriveLock(drive);
|
||||
BlkDevInit(bd);
|
||||
if (bd->flags & BDF_READ_CACHE)
|
||||
DiskCacheInvalidate2(dv);
|
||||
DiskCacheInvalidate2(drive);
|
||||
if (bd->type==BDT_ATAPI && !(bd->flags & BDF_READ_ONLY_OVERRIDE))
|
||||
ISOInit(dv,(32767/bd->blk_size+1)*bd->blk_size>>BLK_SIZE_BITS);
|
||||
ISOInit(drive,(32767/bd->blk_size+1)*bd->blk_size>>BLK_SIZE_BITS);
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
}
|
||||
|
||||
U0 DiskChg(U8 drv_let=0)
|
||||
U0 DiskChange(U8 drv_let=0)
|
||||
{//Change disk. (Needed for removable media.)
|
||||
CDrive *dv=Letter2Drive(drv_let);
|
||||
CBlkDev *bd=dv->bd;
|
||||
CDrive *drive=Letter2Drive(drv_let);
|
||||
CBlkDev *bd=drive->bd;
|
||||
if (!(bd->flags&BDF_INITIALIZED))
|
||||
BlkDevInit(bd);
|
||||
else if (bd->flags&BDF_REMOVABLE) {
|
||||
if (bd->type==BDT_ATAPI)
|
||||
ATAInit(bd); //TODO: This is a kludge for QEMU?
|
||||
DiskCacheInvalidate(dv);
|
||||
DiskCacheInvalidate(drive);
|
||||
}
|
||||
Drive(drv_let);
|
||||
RedSeaFreeFreeList(dv);
|
||||
RedSeaFreeFreeList(drive);
|
||||
}
|
||||
|
||||
Bool DriveMap(U8 drv_let,CDrive *dv)
|
||||
Bool DriveMap(U8 drv_let,CDrive *drive)
|
||||
{//Make drive letter map to another.
|
||||
drv_let=Letter2Letter(drv_let);
|
||||
if ('A'<=drv_let<='Z') {
|
||||
blkdev.let_to_drv[drv_let-'A']=dv;
|
||||
dv->drv_let=drv_let;
|
||||
blkdev.let_to_drive[drv_let-'A']=drive;
|
||||
drive->drv_let=drv_let;
|
||||
return TRUE;
|
||||
} else
|
||||
return FALSE;
|
||||
@ -262,20 +262,20 @@ Bool DriveMap(U8 drv_let,CDrive *dv)
|
||||
|
||||
Bool Drive(U8 drv_let)
|
||||
{//Change drive. You can set drive with $LK,"Cd",A="MN:Cd"$() as well.
|
||||
CDrive *dv=Letter2Drive(drv_let);
|
||||
CDrive *drive=Letter2Drive(drv_let);
|
||||
CBlkDev *bd;
|
||||
bd=BlkDevCheck(dv->bd);
|
||||
if (dv!=Fs->cur_dv) {
|
||||
bd=BlkDevCheck(drive->bd);
|
||||
if (drive!=Fs->cur_dv) {
|
||||
if (bd->flags & BDF_REMOVABLE && !(bd->flags & BDF_INITIALIZED))
|
||||
DiskChg(Drive2Letter(dv));
|
||||
DiskChange(Drive2Letter(drive));
|
||||
if (bd->type==BDT_RAM ||
|
||||
bd->type==BDT_ISO_FILE_READ || bd->type==BDT_ISO_FILE_WRITE)
|
||||
BlkDevInit(bd);
|
||||
}
|
||||
Fs->cur_dv=dv;
|
||||
Fs->cur_dv=drive;
|
||||
Free(Fs->cur_dir);
|
||||
Fs->cur_dir=StrNew("/");
|
||||
switch (dv->fs_type) {
|
||||
switch (drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
case FSt_FAT32:
|
||||
return TRUE;
|
||||
@ -330,24 +330,24 @@ U8 DriveTextAttrGet(U8 drv_let=0)
|
||||
|
||||
U0 DriveRep()
|
||||
{//Drive report.
|
||||
CDrive *dv;
|
||||
CDrive *drive;
|
||||
CBlkDev *bd;
|
||||
I64 ch,i,drv_let,attr;
|
||||
U8 *st;
|
||||
"\nDefined Drives:\n";
|
||||
for (i=0,dv=blkdev.drvs;i<DRVS_NUM;i++,dv++) {
|
||||
if (dv->dv_signature==DRV_SIGNATURE_VAL) {
|
||||
bd=dv->bd;
|
||||
drv_let=Drive2Letter(dv);
|
||||
if (Bt(&dv->fs_type,FStf_DISABLE))
|
||||
for (i=0,drive=blkdev.drvs;i<DRIVES_NUM;i++,drive++) {
|
||||
if (drive->drive_signature==DRIVE_SIGNATURE_VAL) {
|
||||
bd=drive->bd;
|
||||
drv_let=Drive2Letter(drive);
|
||||
if (Bt(&drive->fs_type,FStf_DISABLE))
|
||||
ch='-';
|
||||
else if (drv_let==blkdev.boot_drv_let)
|
||||
else if (drv_let==blkdev.boot_drive_let)
|
||||
ch=':';
|
||||
else
|
||||
ch='+';
|
||||
attr=DriveTextAttrGet(drv_let);
|
||||
"$$FG,%d$$$$BG,%d$$%C %-8Z %-10Z %04X %04X %02X\n",
|
||||
attr&15,attr>>4,drv_let,dv->fs_type&FSG_TYPE_MASK,"ST_DRV_TYPES",
|
||||
attr&15,attr>>4,drv_let,drive->fs_type&FSG_TYPE_MASK,"ST_DRIVE_TYPES",
|
||||
bd->type,"ST_BLKDEV_TYPES",bd->base0,bd->base1,bd->unit;
|
||||
if (st=DriveModelNum(drv_let)) {
|
||||
"Model#:%s\n",st;
|
||||
@ -358,8 +358,8 @@ U0 DriveRep()
|
||||
Free(st);
|
||||
}
|
||||
if (bd->type==BDT_ISO_FILE_READ || bd->type==BDT_ISO_FILE_WRITE)
|
||||
"File=\"%s\"\n",bd->file_dsk_name;
|
||||
"%016X-%016X\n$$FG$$$$BG$$",dv->drv_offset,dv->drv_offset+dv->size-1;
|
||||
"File=\"%s\"\n",bd->file_disk_name;
|
||||
"%016X-%016X\n$$FG$$$$BG$$",drive->drv_offset,drive->drv_offset+drive->size-1;
|
||||
}
|
||||
}
|
||||
"Home Dir:\"%s\"\n",blkdev.home_dir;
|
||||
|
@ -21,12 +21,12 @@ U8 *FileRead(U8 *filename,I64 *_size=NULL,I64 *_attr=NULL)
|
||||
else
|
||||
curname=altname;
|
||||
if (dirc=DirContextNew(curname)) {
|
||||
switch (dirc->dv->fs_type) {
|
||||
switch (dirc->drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
res=RedSeaFileRead(dirc->dv,Fs->cur_dir,dirc->mask,&size,&attr);
|
||||
res=RedSeaFileRead(dirc->drive,Fs->cur_dir,dirc->mask,&size,&attr);
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
res=FAT32FileRead(dirc->dv,Fs->cur_dir,dirc->mask,&size,&attr);
|
||||
res=FAT32FileRead(dirc->drive,Fs->cur_dir,dirc->mask,&size,&attr);
|
||||
break;
|
||||
default:
|
||||
PrintErr("File System Not Supported\n");
|
||||
@ -46,10 +46,10 @@ U8 *FileRead(U8 *filename,I64 *_size=NULL,I64 *_attr=NULL)
|
||||
Cd("..");
|
||||
switch (Fs->cur_dv->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
res=RedSeaFileRead(dirc->dv,Fs->cur_dir,dirc->mask,&size,&attr);
|
||||
res=RedSeaFileRead(dirc->drive,Fs->cur_dir,dirc->mask,&size,&attr);
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
res=FAT32FileRead(dirc->dv,Fs->cur_dir,dirc->mask,&size,&attr);
|
||||
res=FAT32FileRead(dirc->drive,Fs->cur_dir,dirc->mask,&size,&attr);
|
||||
break;
|
||||
default:
|
||||
PrintErr("File System Not Supported\n");
|
||||
@ -85,12 +85,12 @@ I64 FileWrite(U8 *filename,U8 *fbuf,I64 size,CDate cdt=0,I64 attr=0)
|
||||
if (dirc=DirContextNew(filename,FALSE,TRUE)) {
|
||||
attr=FileAttr(dirc->mask,attr);
|
||||
if (!cdt) cdt=Now;
|
||||
switch (dirc->dv->fs_type) {
|
||||
switch (dirc->drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
c=RedSeaFileWrite(dirc->dv,Fs->cur_dir,dirc->mask,fbuf,size,cdt,attr);
|
||||
c=RedSeaFileWrite(dirc->drive,Fs->cur_dir,dirc->mask,fbuf,size,cdt,attr);
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
c=FAT32FileWrite(dirc->dv,Fs->cur_dir,dirc->mask,fbuf,size,cdt,attr);
|
||||
c=FAT32FileWrite(dirc->drive,Fs->cur_dir,dirc->mask,fbuf,size,cdt,attr);
|
||||
break;
|
||||
default:
|
||||
PrintErr("File System Not Supported\n");
|
||||
|
@ -1,9 +1,9 @@
|
||||
CDirEntry *FilesFind2(U8 *files_find_mask,I64 fuf_flags)
|
||||
{
|
||||
CDrive *dv=Fs->cur_dv;
|
||||
CDrive *drive=Fs->cur_dv;
|
||||
CDirEntry *res=NULL;
|
||||
DriveCheck(dv);
|
||||
switch (dv->fs_type) {
|
||||
DriveCheck(drive);
|
||||
switch (drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
res=RedSeaFilesFind(files_find_mask,fuf_flags);
|
||||
break;
|
||||
@ -78,14 +78,14 @@ Bool FileFind(U8 *filename,CDirEntry *_de=NULL,I64 fuf_flags=0)
|
||||
Silent(old_silent);
|
||||
else {
|
||||
Silent(old_silent);
|
||||
cur_dir_clus=Name2DirClus(dirc->dv,Fs->cur_dir);
|
||||
switch (dirc->dv->fs_type) {
|
||||
cur_dir_clus=Name2DirClus(dirc->drive,Fs->cur_dir);
|
||||
switch (dirc->drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
res=RedSeaFileFind(dirc->dv,cur_dir_clus,dirc->mask,
|
||||
res=RedSeaFileFind(dirc->drive,cur_dir_clus,dirc->mask,
|
||||
&de,fuf_flags);
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
res=FAT32FileFind(dirc->dv,cur_dir_clus,dirc->mask,
|
||||
res=FAT32FileFind(dirc->drive,cur_dir_clus,dirc->mask,
|
||||
&de,fuf_flags);
|
||||
break;
|
||||
default:
|
||||
@ -111,17 +111,17 @@ Bool FileFind(U8 *filename,CDirEntry *_de=NULL,I64 fuf_flags=0)
|
||||
Silent(old_silent);
|
||||
else {
|
||||
Silent(old_silent);
|
||||
cur_dir_clus=Name2DirClus(dirc->dv,Fs->cur_dir);
|
||||
cur_dir_clus=Name2DirClus(dirc->drive,Fs->cur_dir);
|
||||
while (!res && StrCmp(Fs->cur_dir,"/")) {
|
||||
Cd("..");
|
||||
cur_dir_clus=Name2DirClus(dirc->dv,Fs->cur_dir);
|
||||
switch (dirc->dv->fs_type) {
|
||||
cur_dir_clus=Name2DirClus(dirc->drive,Fs->cur_dir);
|
||||
switch (dirc->drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
res=RedSeaFileFind(dirc->dv,cur_dir_clus,
|
||||
res=RedSeaFileFind(dirc->drive,cur_dir_clus,
|
||||
dirc->mask,&de,fuf_flags);
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
res=FAT32FileFind(dirc->dv,cur_dir_clus,
|
||||
res=FAT32FileFind(dirc->drive,cur_dir_clus,
|
||||
dirc->mask,&de,fuf_flags);
|
||||
break;
|
||||
default:
|
||||
|
@ -5,7 +5,7 @@ Bool DriveTypeSet(U8 drv_let,I64 type=FSt_REDSEA)
|
||||
CBlkDev *bd;
|
||||
drv_let=Letter2Letter(drv_let);
|
||||
bd=Letter2BlkDev(drv_let);
|
||||
drv_num=bd->first_drv_let-'A';
|
||||
drv_num=bd->first_drive_let-'A';
|
||||
switch (bd->type) {
|
||||
case BDT_ATA:
|
||||
offset=0;
|
||||
@ -58,17 +58,17 @@ U0 Fmt(I64 drv_let,Bool quick=TRUE,Bool confirm=TRUE,I64 type=FSt_FAT32)
|
||||
//quick=FALSE means fill entire drive with zeros.
|
||||
//Choose $LK,"FSt_FAT32",A="MN:FSt_FAT32"$ or $LK,"FSt_REDSEA",A="MN:FSt_REDSEA"$.
|
||||
//You don't format a CD/DVD with this.
|
||||
CDrive *dv=Letter2Drive(drv_let);
|
||||
CDrive *drive=Letter2Drive(drv_let);
|
||||
Bool old_silent=IsSilent;
|
||||
if (confirm && !AreYouSure)
|
||||
return;
|
||||
if (!dv) {
|
||||
if (!drive) {
|
||||
PrintErr("Invalid Drive\n");
|
||||
return;
|
||||
}
|
||||
switch (type) {
|
||||
case FSt_FAT32:
|
||||
if (dv->bd->type==BDT_ATA) {
|
||||
if (drive->bd->type==BDT_ATA) {
|
||||
Silent;
|
||||
Drive(drv_let);
|
||||
Silent(old_silent);
|
||||
|
@ -118,7 +118,7 @@ U8 *DirNameAbs(U8 *_dirname)
|
||||
drv[2]=0;
|
||||
if (*dirname && dirname[1]==':') {
|
||||
if (*dirname==':')
|
||||
*drv=blkdev.boot_drv_let;
|
||||
*drv=blkdev.boot_drive_let;
|
||||
else if (*dirname=='~')
|
||||
*drv=*blkdev.home_dir;
|
||||
else
|
||||
@ -200,7 +200,7 @@ U8 *FileNameAbs(U8 *_filename,I64 fuf_flags=0)
|
||||
return res;
|
||||
}
|
||||
|
||||
U8 *ExtChg(U8 *filename,U8 *extension)
|
||||
U8 *ExtChange(U8 *filename,U8 *extension)
|
||||
{//Change filename extension.
|
||||
U8 *res=MAlloc(StrLen(filename)+1+StrLen(extension)+1);
|
||||
StrCpy(res,filename);
|
||||
|
@ -7,25 +7,25 @@ Bool CFileNameTo(U8 *dst,U8 *src)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
I64 Name2DirClus(CDrive *dv,U8 *dirname)
|
||||
I64 Name2DirClus(CDrive *drive,U8 *dirname)
|
||||
{
|
||||
Bool cont=TRUE,unlock;
|
||||
I64 cur_dir_clus;
|
||||
CDirEntry de;
|
||||
U8 *buf=StrNew(dirname),*buf2=StrNew(dirname);
|
||||
DriveCheck(dv);
|
||||
DriveCheck(drive);
|
||||
try {
|
||||
unlock=DriveLock(dv);
|
||||
cur_dir_clus=dv->root_clus;
|
||||
unlock=DriveLock(drive);
|
||||
cur_dir_clus=drive->root_clus;
|
||||
while (*buf && cont) {
|
||||
StrFirstRemove(buf,"/",buf2);
|
||||
if (*buf2) {
|
||||
switch (dv->fs_type) {
|
||||
switch (drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
cont=RedSeaFileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
|
||||
cont=RedSeaFileFind(drive,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
cont=FAT32FileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
|
||||
cont=FAT32FileFind(drive,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
|
||||
break;
|
||||
default:
|
||||
throw('Drive');
|
||||
@ -38,35 +38,35 @@ I64 Name2DirClus(CDrive *dv,U8 *dirname)
|
||||
cur_dir_clus=0;
|
||||
}
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
Free(buf);
|
||||
Free(buf2);
|
||||
return cur_dir_clus;
|
||||
}
|
||||
|
||||
I64 Name2ParentDirClus(CDrive *dv,U8 *dirname)
|
||||
I64 Name2ParentDirClus(CDrive *drive,U8 *dirname)
|
||||
{
|
||||
Bool cont=TRUE,unlock;
|
||||
I64 cur_dir_clus,cur_dir_clus2;
|
||||
CDirEntry de;
|
||||
U8 *buf=StrNew(dirname),*buf2=StrNew(dirname);
|
||||
DriveCheck(dv);
|
||||
DriveCheck(drive);
|
||||
try {
|
||||
unlock=DriveLock(dv);
|
||||
cur_dir_clus=cur_dir_clus2=dv->root_clus;
|
||||
unlock=DriveLock(drive);
|
||||
cur_dir_clus=cur_dir_clus2=drive->root_clus;
|
||||
while (*buf && cont) {
|
||||
cur_dir_clus2=cur_dir_clus;
|
||||
StrFirstRemove(buf,"/",buf2);
|
||||
if (*buf2) {
|
||||
switch (dv->fs_type) {
|
||||
switch (drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
cont=RedSeaFileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
|
||||
cont=RedSeaFileFind(drive,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
cont=FAT32FileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
|
||||
cont=FAT32FileFind(drive,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
|
||||
break;
|
||||
default:
|
||||
throw('Drive');
|
||||
@ -79,10 +79,10 @@ I64 Name2ParentDirClus(CDrive *dv,U8 *dirname)
|
||||
cur_dir_clus2=0;
|
||||
}
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
Free(buf);
|
||||
Free(buf2);
|
||||
return cur_dir_clus2;
|
||||
|
@ -19,58 +19,58 @@ CDate Dos2CDate(U16 t,U16 d)
|
||||
return Struct2Date(&ds);
|
||||
}
|
||||
|
||||
U0 FAT32Init(CDrive *dv)
|
||||
U0 FAT32Init(CDrive *drive)
|
||||
{
|
||||
CFAT32Boot br32;
|
||||
Bool unlock;
|
||||
try {
|
||||
unlock=DriveLock(dv);
|
||||
dv->fs_type=FSt_FAT32;
|
||||
BlkRead(dv,&br32,dv->drv_offset,1);
|
||||
dv->file_system_info_sect=dv->drv_offset+br32.file_system_info_sect;
|
||||
dv->fat1=dv->drv_offset+br32.reserved_sects;
|
||||
dv->fat2=dv->fat1+br32.sects_per_fat;
|
||||
dv->data_area=dv->fat2+br32.sects_per_fat
|
||||
unlock=DriveLock(drive);
|
||||
drive->fs_type=FSt_FAT32;
|
||||
BlkRead(drive,&br32,drive->drv_offset,1);
|
||||
drive->file_system_info_sect=drive->drv_offset+br32.file_system_info_sect;
|
||||
drive->fat1=drive->drv_offset+br32.reserved_sects;
|
||||
drive->fat2=drive->fat1+br32.sects_per_fat;
|
||||
drive->data_area=drive->fat2+br32.sects_per_fat
|
||||
-2*br32.sects_per_clus; //Starts at Clus 2
|
||||
dv->spc=br32.sects_per_clus;
|
||||
dv->root_clus=br32.root_clus;
|
||||
DriveFATBlkAlloc(dv);
|
||||
Free(dv->fis);
|
||||
dv->fis=AMAlloc(BLK_SIZE);
|
||||
BlkRead(dv,dv->fis,dv->file_system_info_sect,1);
|
||||
drive->spc=br32.sects_per_clus;
|
||||
drive->root_clus=br32.root_clus;
|
||||
DriveFATBlkAlloc(drive);
|
||||
Free(drive->fis);
|
||||
drive->fis=AMAlloc(BLK_SIZE);
|
||||
BlkRead(drive,drive->fis,drive->file_system_info_sect,1);
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
}
|
||||
|
||||
U0 FAT32Fmt(U8 drv_let,Bool quick=TRUE)
|
||||
{
|
||||
CFAT32Boot *br=CAlloc(BLK_SIZE);
|
||||
CFAT32FileInfoSect *fis=CAlloc(BLK_SIZE);
|
||||
CDrive *dv=Letter2Drive(drv_let);
|
||||
CDrive *drive=Letter2Drive(drv_let);
|
||||
I64 i,l;
|
||||
try {
|
||||
DriveLock(dv);
|
||||
DriveLock(drive);
|
||||
DriveTypeSet(drv_let,FSt_FAT32);
|
||||
dv->fs_type=FSt_FAT32;
|
||||
drive->fs_type=FSt_FAT32;
|
||||
br->jump_and_nop[0]=OC_JMP_REL8;
|
||||
br->jump_and_nop[1]=offset(CFAT32Boot.code)-2;
|
||||
br->jump_and_nop[2]=OC_NOP;
|
||||
br->oem_name[0](I64)='MSWIN4.1';
|
||||
br->bytes_per_sect=BLK_SIZE;
|
||||
if (dv->size<= 500000)
|
||||
if (drive->size<= 500000)
|
||||
br->sects_per_clus=1;
|
||||
else if (dv->size<=2000000)
|
||||
else if (drive->size<=2000000)
|
||||
br->sects_per_clus=2;
|
||||
else if (dv->size<=6000000)
|
||||
else if (drive->size<=6000000)
|
||||
br->sects_per_clus=4;
|
||||
else if (dv->size<=12000000)
|
||||
else if (drive->size<=12000000)
|
||||
br->sects_per_clus=8;
|
||||
else if (dv->size<=33000000)
|
||||
else if (drive->size<=33000000)
|
||||
br->sects_per_clus=16;
|
||||
else if (dv->size<=67000000)
|
||||
else if (drive->size<=67000000)
|
||||
br->sects_per_clus=32;
|
||||
else
|
||||
br->sects_per_clus=64;
|
||||
@ -78,12 +78,12 @@ U0 FAT32Fmt(U8 drv_let,Bool quick=TRUE)
|
||||
br->reserved_sects=32;
|
||||
br->copies_of_fat=2;
|
||||
br->media_desc=0xF8;
|
||||
br->sects=dv->size;
|
||||
br->sects=drive->size;
|
||||
l=(br->sects/br->sects_per_clus)>>(BLK_SIZE_BITS-2)+1;
|
||||
br->sects_per_fat=l;
|
||||
br->root_clus=2;
|
||||
br->file_system_info_sect=1;
|
||||
br->log_drv_num=0x80;
|
||||
br->log_drive_num=0x80;
|
||||
br->ext_signature=0x29;
|
||||
br->serial_num=RandU32;
|
||||
MemCpy(br->vol_name,"NONAME",11);
|
||||
@ -98,19 +98,19 @@ U0 FAT32Fmt(U8 drv_let,Bool quick=TRUE)
|
||||
if (quick)
|
||||
i=br->reserved_sects+2*l+4*br->sects_per_clus;
|
||||
else
|
||||
i=dv->size;
|
||||
BlkWriteZero(dv,dv->drv_offset,i);
|
||||
i=drive->size;
|
||||
BlkWriteZero(drive,drive->drv_offset,i);
|
||||
|
||||
BlkWrite(dv,fis,dv->drv_offset+br->file_system_info_sect,1);
|
||||
BlkWrite(dv,br,dv->drv_offset,1);
|
||||
FAT32Init(dv);
|
||||
ClusAlloc(dv,0,1,FALSE); //Alloc #1
|
||||
br->root_clus=ClusAlloc(dv,0,1,FALSE);
|
||||
BlkWrite(dv,br,dv->drv_offset,1);
|
||||
FAT32Init(dv);
|
||||
DriveUnlock(dv);
|
||||
BlkWrite(drive,fis,drive->drv_offset+br->file_system_info_sect,1);
|
||||
BlkWrite(drive,br,drive->drv_offset,1);
|
||||
FAT32Init(drive);
|
||||
ClusAlloc(drive,0,1,FALSE); //Alloc #1
|
||||
br->root_clus=ClusAlloc(drive,0,1,FALSE);
|
||||
BlkWrite(drive,br,drive->drv_offset,1);
|
||||
FAT32Init(drive);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
Free(br);
|
||||
Free(fis);
|
||||
}
|
||||
@ -283,7 +283,7 @@ Bool FAT32DirFill(CFAT32DirEntry *de,
|
||||
return res;
|
||||
}
|
||||
|
||||
Bool FAT32FileFind(CDrive *dv,I64 cur_dir_clus,
|
||||
Bool FAT32FileFind(CDrive *drive,I64 cur_dir_clus,
|
||||
U8 *name,CDirEntry *_res,I64 fuf_flags=0)
|
||||
{//$LK,"FUF_JUST_DIRS",A="MN:FUF_JUST_DIRS"$, $LK,"FUF_JUST_FILES",A="MN:FUF_JUST_FILES"$
|
||||
Bool res=FALSE,unlock;
|
||||
@ -295,17 +295,17 @@ Bool FAT32FileFind(CDrive *dv,I64 cur_dir_clus,
|
||||
throw('FUF');
|
||||
MemSet(_res,0,sizeof(CDirEntry));
|
||||
MemSet(&long_name,0,sizeof(CDirEntry));
|
||||
DriveCheck(dv);
|
||||
if (dv->fs_type!=FSt_FAT32)
|
||||
DriveCheck(drive);
|
||||
if (drive->fs_type!=FSt_FAT32)
|
||||
PrintErr("Not FAT32 Drive\n");
|
||||
else if (!CFileNameTo(dname,name))
|
||||
PrintErr("Invalid FileName: \"%s\".\n",name);
|
||||
else
|
||||
try {
|
||||
unlock=DriveLock(dv);
|
||||
buf=MAlloc(BLK_SIZE*dv->spc);
|
||||
entries_per_clus=dv->spc<<FAT32_ENTRIES_BITS;
|
||||
ClusRead(dv,buf,cur_dir_clus,1);
|
||||
unlock=DriveLock(drive);
|
||||
buf=MAlloc(BLK_SIZE*drive->spc);
|
||||
entries_per_clus=drive->spc<<FAT32_ENTRIES_BITS;
|
||||
ClusRead(drive,buf,cur_dir_clus,1);
|
||||
cur_dir_entry=0;
|
||||
while (ch=*buf[cur_dir_entry].name) {
|
||||
attr=buf[cur_dir_entry].attr;
|
||||
@ -321,7 +321,7 @@ Bool FAT32FileFind(CDrive *dv,I64 cur_dir_clus,
|
||||
if (!(fuf_flags&FUF_JUST_DIRS && !(attr & RS_ATTR_DIR)) &&
|
||||
!(fuf_flags&FUF_JUST_FILES && attr & RS_ATTR_DIR) &&
|
||||
FAT32CDirFill(_res,&buf[cur_dir_entry],
|
||||
dv->fat32_local_time_offset) &&
|
||||
drive->fat32_local_time_offset) &&
|
||||
!StrCmp(dname,_res->name)) {
|
||||
res=TRUE;
|
||||
goto fff_done;
|
||||
@ -332,11 +332,11 @@ Bool FAT32FileFind(CDrive *dv,I64 cur_dir_clus,
|
||||
} else
|
||||
MemSet(&long_name,0,sizeof(CDirEntry));
|
||||
if (++cur_dir_entry==entries_per_clus) {
|
||||
cur_dir_clus=ClusNumNext(dv,cur_dir_clus);
|
||||
cur_dir_clus=ClusNumNext(drive,cur_dir_clus);
|
||||
if (!(0<cur_dir_clus<0x0FFFFFF8))
|
||||
break;
|
||||
else {
|
||||
ClusRead(dv,buf,cur_dir_clus,1);
|
||||
ClusRead(drive,buf,cur_dir_clus,1);
|
||||
cur_dir_entry=0;
|
||||
}
|
||||
}
|
||||
@ -345,42 +345,42 @@ Bool FAT32FileFind(CDrive *dv,I64 cur_dir_clus,
|
||||
fff_done:
|
||||
Free(buf);
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
return res;
|
||||
}
|
||||
|
||||
U8 *FAT32FileRead(CDrive *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
|
||||
U8 *FAT32FileRead(CDrive *drive,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
|
||||
{
|
||||
U8 *buf=NULL;
|
||||
CDirEntry de;
|
||||
I64 c,blk_count,cur_dir_clus;
|
||||
DriveCheck(dv);
|
||||
DriveCheck(drive);
|
||||
*_size=0;
|
||||
*_attr=0;
|
||||
if (dv->fs_type!=FSt_FAT32)
|
||||
if (drive->fs_type!=FSt_FAT32)
|
||||
PrintErr("Not FAT32 Drive\n");
|
||||
else
|
||||
try {
|
||||
DriveLock(dv);
|
||||
cur_dir_clus=Name2DirClus(dv,cur_dir);
|
||||
if (FAT32FileFind(dv,cur_dir_clus,filename,&de,FUF_JUST_FILES)) {
|
||||
DriveLock(drive);
|
||||
cur_dir_clus=Name2DirClus(drive,cur_dir);
|
||||
if (FAT32FileFind(drive,cur_dir_clus,filename,&de,FUF_JUST_FILES)) {
|
||||
blk_count=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
buf=MAlloc(blk_count<<BLK_SIZE_BITS+1);
|
||||
c=de.clus;
|
||||
if (!(0<c<0x0FFFFFF8))
|
||||
c=0x0FFFFFFF;
|
||||
else
|
||||
c=ClusBlkRead(dv,buf,c,blk_count);
|
||||
c=ClusBlkRead(drive,buf,c,blk_count);
|
||||
buf[de.size]=0; //Terminate
|
||||
*_size=de.size;
|
||||
*_attr=FileAttr(de.name,de.attr);
|
||||
}
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@ -396,50 +396,50 @@ Bool FAT32Cd(U8 *name,I64 cur_dir_clus)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
U0 FAT32FreeClus(CDrive *dv,I64 c)
|
||||
U0 FAT32FreeClus(CDrive *drive,I64 c)
|
||||
{
|
||||
I64 next,saved_c=c;
|
||||
Bool unlock,unlock_break;
|
||||
DriveCheck(dv);
|
||||
DriveCheck(drive);
|
||||
if (!(0<c<0x0FFFFFF8)) return;
|
||||
if (dv->fs_type!=FSt_FAT32)
|
||||
if (drive->fs_type!=FSt_FAT32)
|
||||
PrintErr("Not FAT32 Drive\n");
|
||||
else
|
||||
try {
|
||||
unlock_break=BreakLock;
|
||||
unlock=DriveLock(dv);
|
||||
DriveFATBlkClean(dv);
|
||||
unlock=DriveLock(drive);
|
||||
DriveFATBlkClean(drive);
|
||||
do {
|
||||
DriveFATBlkSet(dv,c,0);
|
||||
next=dv->cur_fat_blk[c&(BLK_SIZE/4-1)];
|
||||
dv->cur_fat_blk[c&(BLK_SIZE/4-1)]=0;
|
||||
LBts(&dv->fat_blk_dirty,0);
|
||||
DriveFATBlkSet(drive,c,0);
|
||||
next=drive->cur_fat_blk[c&(BLK_SIZE/4-1)];
|
||||
drive->cur_fat_blk[c&(BLK_SIZE/4-1)]=0;
|
||||
LBts(&drive->fat_blk_dirty,0);
|
||||
c=next;
|
||||
} while (0<c<0x0FFFFFF8);
|
||||
DriveFATBlkClean(dv,0);
|
||||
DriveFATBlkClean(drive,0);
|
||||
|
||||
c=saved_c;
|
||||
do {
|
||||
DriveFATBlkSet(dv,c,1);
|
||||
next=dv->cur_fat_blk[c&(BLK_SIZE/4-1)];
|
||||
dv->cur_fat_blk[c&(BLK_SIZE/4-1)]=0;
|
||||
LBts(&dv->fat_blk_dirty,0);
|
||||
DriveFATBlkSet(drive,c,1);
|
||||
next=drive->cur_fat_blk[c&(BLK_SIZE/4-1)];
|
||||
drive->cur_fat_blk[c&(BLK_SIZE/4-1)]=0;
|
||||
LBts(&drive->fat_blk_dirty,0);
|
||||
c=next;
|
||||
} while (0<c<0x0FFFFFF8);
|
||||
DriveFATBlkClean(dv,1);
|
||||
DriveFATBlkClean(drive,1);
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
} catch {
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
}
|
||||
}
|
||||
|
||||
I64 FAT32AllocClus(CDrive *dv,I64 c,I64 count)
|
||||
I64 FAT32AllocClus(CDrive *drive,I64 c,I64 count)
|
||||
{
|
||||
Bool wrap_around=FALSE,unlock,unlock_break;
|
||||
I64 first=INVALID_CLUS,j,l;
|
||||
@ -447,9 +447,9 @@ I64 FAT32AllocClus(CDrive *dv,I64 c,I64 count)
|
||||
if (count<=0) return 0x0FFFFFFF;
|
||||
try {
|
||||
unlock_break=BreakLock;
|
||||
unlock=DriveLock(dv);
|
||||
l=(dv->size+dv->drv_offset-dv->data_area)/dv->spc-1;
|
||||
j=dv->fis->most_recently_alloced;
|
||||
unlock=DriveLock(drive);
|
||||
l=(drive->size+drive->drv_offset-drive->data_area)/drive->spc-1;
|
||||
j=drive->fis->most_recently_alloced;
|
||||
while (count-->0) {
|
||||
while (TRUE) {
|
||||
j++;
|
||||
@ -460,44 +460,44 @@ I64 FAT32AllocClus(CDrive *dv,I64 c,I64 count)
|
||||
j=1;
|
||||
wrap_around=TRUE;
|
||||
}
|
||||
DriveFATBlkSet(dv,j);
|
||||
if (!dv->cur_fat_blk[j&(BLK_SIZE/4-1)])
|
||||
DriveFATBlkSet(drive,j);
|
||||
if (!drive->cur_fat_blk[j&(BLK_SIZE/4-1)])
|
||||
break;
|
||||
}
|
||||
if (!(0<first<0x0FFFFFF8))
|
||||
first=j;
|
||||
if (0<c<l) {
|
||||
DriveFATBlkSet(dv,c);
|
||||
dv->cur_fat_blk[c&(BLK_SIZE/4-1)]=j;
|
||||
LBts(&dv->fat_blk_dirty,0);
|
||||
DriveFATBlkSet(drive,c);
|
||||
drive->cur_fat_blk[c&(BLK_SIZE/4-1)]=j;
|
||||
LBts(&drive->fat_blk_dirty,0);
|
||||
}
|
||||
c=j;
|
||||
}
|
||||
|
||||
if (0<c<l) {
|
||||
DriveFATBlkSet(dv,c);
|
||||
dv->cur_fat_blk[c&(BLK_SIZE/4-1)]=0x0FFFFFFF;
|
||||
LBts(&dv->fat_blk_dirty,0);
|
||||
DriveFATBlkSet(drive,c);
|
||||
drive->cur_fat_blk[c&(BLK_SIZE/4-1)]=0x0FFFFFFF;
|
||||
LBts(&drive->fat_blk_dirty,0);
|
||||
}
|
||||
DriveFATBlkClean(dv);
|
||||
DriveFATBlkClean(drive);
|
||||
|
||||
dv->fis->most_recently_alloced=j;
|
||||
dv->fis->free_clus=-1;
|
||||
BlkWrite(dv,dv->fis,dv->file_system_info_sect,1);
|
||||
drive->fis->most_recently_alloced=j;
|
||||
drive->fis->free_clus=-1;
|
||||
BlkWrite(drive,drive->fis,drive->file_system_info_sect,1);
|
||||
} catch {
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
}
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
return first;
|
||||
}
|
||||
|
||||
I64 FAT32AllocContiguousClus(CDrive *dv,I64 count)
|
||||
I64 FAT32AllocContiguousClus(CDrive *drive,I64 count)
|
||||
{
|
||||
I64 i,first=1;
|
||||
Bool cont,unlock,unlock_break;
|
||||
@ -505,16 +505,16 @@ I64 FAT32AllocContiguousClus(CDrive *dv,I64 count)
|
||||
if (count<=0) return 0x0FFFFFFF;
|
||||
try {
|
||||
unlock_break=BreakLock;
|
||||
unlock=DriveLock(dv);
|
||||
unlock=DriveLock(drive);
|
||||
while (TRUE) {
|
||||
first++;
|
||||
i=0;
|
||||
cont=TRUE;
|
||||
while (cont && i<count) {
|
||||
if ((first+i+1)*dv->spc+dv->data_area>dv->size+dv->drv_offset)
|
||||
if ((first+i+1)*drive->spc+drive->data_area>drive->size+drive->drv_offset)
|
||||
throw('Drive');
|
||||
DriveFATBlkSet(dv,first+i);
|
||||
if (dv->cur_fat_blk[(first+i)&(BLK_SIZE/4-1)])
|
||||
DriveFATBlkSet(drive,first+i);
|
||||
if (drive->cur_fat_blk[(first+i)&(BLK_SIZE/4-1)])
|
||||
cont=FALSE;
|
||||
else
|
||||
i++;
|
||||
@ -522,44 +522,44 @@ I64 FAT32AllocContiguousClus(CDrive *dv,I64 count)
|
||||
if (!cont)
|
||||
first=first+i;
|
||||
else {
|
||||
DriveFATBlkClean(dv);
|
||||
DriveFATBlkClean(drive);
|
||||
|
||||
for (i=0;i<count;i++) {
|
||||
DriveFATBlkSet(dv,first+i,0);
|
||||
DriveFATBlkSet(drive,first+i,0);
|
||||
if (i+1==count)
|
||||
dv->cur_fat_blk[(first+i)&(BLK_SIZE/4-1)]=0x0FFFFFFF;
|
||||
drive->cur_fat_blk[(first+i)&(BLK_SIZE/4-1)]=0x0FFFFFFF;
|
||||
else
|
||||
dv->cur_fat_blk[(first+i)&(BLK_SIZE/4-1)]=first+i+1;
|
||||
LBts(&dv->fat_blk_dirty,0);
|
||||
drive->cur_fat_blk[(first+i)&(BLK_SIZE/4-1)]=first+i+1;
|
||||
LBts(&drive->fat_blk_dirty,0);
|
||||
}
|
||||
DriveFATBlkClean(dv,0);
|
||||
DriveFATBlkClean(drive,0);
|
||||
|
||||
for (i=0;i<count;i++) {
|
||||
DriveFATBlkSet(dv,first+i,1);
|
||||
DriveFATBlkSet(drive,first+i,1);
|
||||
if (i+1==count)
|
||||
dv->cur_fat_blk[(first+i)&(BLK_SIZE/4-1)]=0x0FFFFFFF;
|
||||
drive->cur_fat_blk[(first+i)&(BLK_SIZE/4-1)]=0x0FFFFFFF;
|
||||
else
|
||||
dv->cur_fat_blk[(first+i)&(BLK_SIZE/4-1)]=first+i+1;
|
||||
LBts(&dv->fat_blk_dirty,0);
|
||||
drive->cur_fat_blk[(first+i)&(BLK_SIZE/4-1)]=first+i+1;
|
||||
LBts(&drive->fat_blk_dirty,0);
|
||||
}
|
||||
DriveFATBlkClean(dv,1);
|
||||
DriveFATBlkClean(drive,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
}
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
return first;
|
||||
}
|
||||
|
||||
Bool FAT32DirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
Bool FAT32DirNew(CDrive *drive,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
{
|
||||
//See $LK,"::/Doc/CutCorners.DD"$.
|
||||
CFAT32DirEntry *buf,*last_buf,*tmp_buf,de[3];
|
||||
@ -569,16 +569,16 @@ Bool FAT32DirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
U8 ch;
|
||||
Bool written=FALSE,unlock,unlock_break;
|
||||
CDirEntry long_name;
|
||||
FAT32DirFill(&de,tmpde,&de_count,dv->fat32_local_time_offset);
|
||||
FAT32DirFill(&de,tmpde,&de_count,drive->fat32_local_time_offset);
|
||||
MemSet(&long_name,0,sizeof(CDirEntry));
|
||||
try {
|
||||
unlock_break=BreakLock;
|
||||
unlock=DriveLock(dv);
|
||||
cur_dir_clus=Name2DirClus(dv,cur_dir);
|
||||
buf =MAlloc(BLK_SIZE*dv->spc);
|
||||
last_buf=CAlloc(BLK_SIZE*dv->spc);
|
||||
entries_per_clus=dv->spc<<FAT32_ENTRIES_BITS;
|
||||
ClusRead(dv,buf,cur_dir_clus,1);
|
||||
unlock=DriveLock(drive);
|
||||
cur_dir_clus=Name2DirClus(drive,cur_dir);
|
||||
buf =MAlloc(BLK_SIZE*drive->spc);
|
||||
last_buf=CAlloc(BLK_SIZE*drive->spc);
|
||||
entries_per_clus=drive->spc<<FAT32_ENTRIES_BITS;
|
||||
ClusRead(drive,buf,cur_dir_clus,1);
|
||||
cur_dir_entry=0;
|
||||
while (ch=*buf[cur_dir_entry].name) {
|
||||
attr=buf[cur_dir_entry].attr;
|
||||
@ -595,8 +595,8 @@ Bool FAT32DirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
}
|
||||
if (ch==0xE5 && !written && avail_count>=de_count) {
|
||||
MemCpy(&buf[cur_dir_entry],&de,de_count*sizeof(CFAT32DirEntry));
|
||||
BlkWrite(dv,&buf[cur_dir_entry & -FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_clus*dv->spc
|
||||
BlkWrite(drive,&buf[cur_dir_entry & -FAT32_ENTRIES_PER_BLK],
|
||||
drive->data_area+cur_dir_clus*drive->spc
|
||||
+cur_dir_entry>>FAT32_ENTRIES_BITS,1);
|
||||
cur_dir_entry+=de_count-1; //gets inc'ed
|
||||
written=TRUE;
|
||||
@ -608,12 +608,12 @@ Bool FAT32DirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
//Del old entry with same name
|
||||
if (!StrCmp(long_name.name,tmpde->name)) {
|
||||
if (free_old_chain)
|
||||
FAT32FreeClus(dv,buf[cur_dir_entry].clus_lo+
|
||||
FAT32FreeClus(drive,buf[cur_dir_entry].clus_lo+
|
||||
buf[cur_dir_entry].clus_hi<<16);
|
||||
if (!written) {
|
||||
MemCpy(&buf[cur_dir_entry],&de[de_count-1],sizeof(CFAT32DirEntry));
|
||||
BlkWrite(dv,&buf[cur_dir_entry & -FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_clus*dv->spc
|
||||
BlkWrite(drive,&buf[cur_dir_entry & -FAT32_ENTRIES_PER_BLK],
|
||||
drive->data_area+cur_dir_clus*drive->spc
|
||||
+cur_dir_entry>>FAT32_ENTRIES_BITS,1);
|
||||
written=TRUE;
|
||||
} else {
|
||||
@ -624,8 +624,8 @@ Bool FAT32DirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
==RS_ATTR_LONG_NAME)
|
||||
*buf[cur_dir_entry-i++].name=0xE5;
|
||||
i--;
|
||||
BlkWrite(dv,&buf[(cur_dir_entry-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_clus*dv->spc
|
||||
BlkWrite(drive,&buf[(cur_dir_entry-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
drive->data_area+cur_dir_clus*drive->spc
|
||||
+(cur_dir_entry-i)>>FAT32_ENTRIES_BITS,
|
||||
(i+FAT32_ENTRIES_PER_BLK)>>FAT32_ENTRIES_BITS);
|
||||
if (i==cur_dir_entry && 0<last_dir_clus<0x0FFFFFF8) {
|
||||
@ -635,8 +635,8 @@ Bool FAT32DirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
&RS_ATTR_LONG_NAME_MASK==RS_ATTR_LONG_NAME)
|
||||
*last_buf[entries_per_clus-i++].name=0xE5;
|
||||
if (--i>0)
|
||||
BlkWrite(dv,&buf[(entries_per_clus-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+last_dir_clus*dv->spc
|
||||
BlkWrite(drive,&buf[(entries_per_clus-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
drive->data_area+last_dir_clus*drive->spc
|
||||
+(entries_per_clus-i)>>FAT32_ENTRIES_BITS,
|
||||
(i+FAT32_ENTRIES_PER_BLK-1)>>FAT32_ENTRIES_BITS);
|
||||
}
|
||||
@ -649,13 +649,13 @@ Bool FAT32DirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
if (++cur_dir_entry==entries_per_clus) {
|
||||
last_dir_clus=cur_dir_clus;
|
||||
tmp_buf=buf; buf=last_buf; last_buf=tmp_buf;
|
||||
c=ClusNumNext(dv,cur_dir_clus);
|
||||
c=ClusNumNext(drive,cur_dir_clus);
|
||||
if (!(0<c<0x0FFFFFF8)) {
|
||||
c=ClusAlloc(dv,cur_dir_clus,1,FALSE);
|
||||
MemSet(buf,0,BLK_SIZE*dv->spc);
|
||||
ClusWrite(dv,buf,c,1);
|
||||
c=ClusAlloc(drive,cur_dir_clus,1,FALSE);
|
||||
MemSet(buf,0,BLK_SIZE*drive->spc);
|
||||
ClusWrite(drive,buf,c,1);
|
||||
} else
|
||||
ClusRead(dv,buf,c,1);
|
||||
ClusRead(drive,buf,c,1);
|
||||
cur_dir_clus=c;
|
||||
cur_dir_entry=0;
|
||||
}
|
||||
@ -665,51 +665,51 @@ Bool FAT32DirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
if (avail_count<de_count) {
|
||||
for (i=0;i<avail_count;i++)
|
||||
*buf[cur_dir_entry+i].name=0xE5;
|
||||
BlkWrite(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_clus*dv->spc
|
||||
BlkWrite(drive,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
|
||||
drive->data_area+cur_dir_clus*drive->spc
|
||||
+cur_dir_entry>>FAT32_ENTRIES_BITS,1);
|
||||
cur_dir_entry+=avail_count;
|
||||
if (cur_dir_entry==entries_per_clus) {
|
||||
last_dir_clus=cur_dir_clus;
|
||||
tmp_buf=buf; buf=last_buf; last_buf=tmp_buf;
|
||||
cur_dir_clus=ClusAlloc(dv,cur_dir_clus,1);
|
||||
cur_dir_clus=ClusAlloc(drive,cur_dir_clus,1);
|
||||
cur_dir_entry=0;
|
||||
MemSet(buf,0,BLK_SIZE*dv->spc);
|
||||
ClusWrite(dv,buf,cur_dir_clus,1);
|
||||
MemSet(buf,0,BLK_SIZE*drive->spc);
|
||||
ClusWrite(drive,buf,cur_dir_clus,1);
|
||||
}
|
||||
}
|
||||
MemCpy(&buf[cur_dir_entry],&de,de_count*sizeof(CFAT32DirEntry));
|
||||
BlkWrite(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_clus*dv->spc+
|
||||
BlkWrite(drive,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
|
||||
drive->data_area+cur_dir_clus*drive->spc+
|
||||
cur_dir_entry>>FAT32_ENTRIES_BITS,1);
|
||||
cur_dir_entry+=de_count;
|
||||
if (cur_dir_entry==entries_per_clus) {
|
||||
cur_dir_clus=ClusAlloc(dv,cur_dir_clus,1);
|
||||
MemSet(buf,0,BLK_SIZE*dv->spc);
|
||||
ClusWrite(dv,buf,cur_dir_clus,1);
|
||||
cur_dir_clus=ClusAlloc(drive,cur_dir_clus,1);
|
||||
MemSet(buf,0,BLK_SIZE*drive->spc);
|
||||
ClusWrite(drive,buf,cur_dir_clus,1);
|
||||
} else {
|
||||
MemSet(&buf[cur_dir_entry],0,sizeof(CFAT32DirEntry));
|
||||
BlkWrite(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_clus*dv->spc
|
||||
BlkWrite(drive,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
|
||||
drive->data_area+cur_dir_clus*drive->spc
|
||||
+cur_dir_entry>>FAT32_ENTRIES_BITS,1);
|
||||
}
|
||||
}
|
||||
Free(last_buf);
|
||||
Free(buf);
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
} catch {
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
I64 FAT32FilesDel(CDrive *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
I64 FAT32FilesDel(CDrive *drive,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
Bool del_dir,Bool print_message)
|
||||
{
|
||||
CFAT32DirEntry *buf,*last_buf,*tmp_buf;
|
||||
@ -721,12 +721,12 @@ I64 FAT32FilesDel(CDrive *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
MemSet(&long_name,0,sizeof(CDirEntry));
|
||||
try {
|
||||
unlock_break=BreakLock;
|
||||
DriveLock(dv);
|
||||
cur_dir_clus=Name2DirClus(dv,cur_dir);
|
||||
buf =MAlloc(BLK_SIZE*dv->spc);
|
||||
last_buf=CAlloc(BLK_SIZE*dv->spc);
|
||||
entries_per_clus=dv->spc<<FAT32_ENTRIES_BITS;
|
||||
ClusRead(dv,buf,cur_dir_clus,1);
|
||||
DriveLock(drive);
|
||||
cur_dir_clus=Name2DirClus(drive,cur_dir);
|
||||
buf =MAlloc(BLK_SIZE*drive->spc);
|
||||
last_buf=CAlloc(BLK_SIZE*drive->spc);
|
||||
entries_per_clus=drive->spc<<FAT32_ENTRIES_BITS;
|
||||
ClusRead(drive,buf,cur_dir_clus,1);
|
||||
cur_dir_entry=0;
|
||||
while (ch=*buf[cur_dir_entry].name) {
|
||||
attr=buf[cur_dir_entry].attr;
|
||||
@ -751,8 +751,8 @@ I64 FAT32FilesDel(CDrive *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
==RS_ATTR_LONG_NAME)
|
||||
*buf[cur_dir_entry-i++].name=0xE5;
|
||||
i--;
|
||||
BlkWrite(dv,&buf[(cur_dir_entry-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_clus*dv->spc
|
||||
BlkWrite(drive,&buf[(cur_dir_entry-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
drive->data_area+cur_dir_clus*drive->spc
|
||||
+(cur_dir_entry-i)>>FAT32_ENTRIES_BITS,
|
||||
(i+FAT32_ENTRIES_PER_BLK)>>FAT32_ENTRIES_BITS);
|
||||
if (i==cur_dir_entry && last_dir_clus!=INVALID_CLUS) {
|
||||
@ -762,12 +762,12 @@ I64 FAT32FilesDel(CDrive *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
&RS_ATTR_LONG_NAME_MASK==RS_ATTR_LONG_NAME)
|
||||
*last_buf[entries_per_clus-i++].name=0xE5;
|
||||
if (--i>0)
|
||||
BlkWrite(dv,&buf[(entries_per_clus-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+last_dir_clus*dv->spc
|
||||
BlkWrite(drive,&buf[(entries_per_clus-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
drive->data_area+last_dir_clus*drive->spc
|
||||
+(entries_per_clus-i)>>FAT32_ENTRIES_BITS,
|
||||
(i+FAT32_ENTRIES_PER_BLK-1)>>FAT32_ENTRIES_BITS);
|
||||
}
|
||||
FAT32FreeClus(dv,buf[cur_dir_entry].clus_lo+
|
||||
FAT32FreeClus(drive,buf[cur_dir_entry].clus_lo+
|
||||
buf[cur_dir_entry].clus_hi<<16);
|
||||
}
|
||||
}
|
||||
@ -777,26 +777,26 @@ I64 FAT32FilesDel(CDrive *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
MemSet(&long_name,0,sizeof(CDirEntry));
|
||||
if (++cur_dir_entry==entries_per_clus) {
|
||||
last_dir_clus=cur_dir_clus;
|
||||
cur_dir_clus=ClusNumNext(dv,cur_dir_clus,1);
|
||||
cur_dir_clus=ClusNumNext(drive,cur_dir_clus,1);
|
||||
tmp_buf=buf; buf=last_buf; last_buf=tmp_buf;
|
||||
ClusRead(dv,buf,cur_dir_clus,1);
|
||||
ClusRead(drive,buf,cur_dir_clus,1);
|
||||
cur_dir_entry=0;
|
||||
}
|
||||
}
|
||||
Free(buf);
|
||||
Free(last_buf);
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
} catch {
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 FAT32FileWrite(CDrive *dv,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
|
||||
I64 FAT32FileWrite(CDrive *drive,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
|
||||
CDate cdt,I64 attr)
|
||||
{
|
||||
CDirEntry de;
|
||||
@ -804,27 +804,27 @@ I64 FAT32FileWrite(CDrive *dv,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
|
||||
Bool contiguous;
|
||||
MemSet(&de,0,sizeof(CDirEntry));
|
||||
if (size<0) size=0;
|
||||
if (dv->fs_type!=FSt_FAT32)
|
||||
if (drive->fs_type!=FSt_FAT32)
|
||||
PrintErr("Not FAT32 Drive\n");
|
||||
else if (!CFileNameTo(de.name,name))
|
||||
PrintErr("Invalid FileName: \"%s\".\n",name);
|
||||
else {
|
||||
FAT32FilesDel(dv,cur_dir,de.name,0,FALSE,FALSE);
|
||||
FAT32FilesDel(drive,cur_dir,de.name,0,FALSE,FALSE);
|
||||
if (attr & RS_ATTR_CONTIGUOUS)
|
||||
contiguous=TRUE;
|
||||
else
|
||||
contiguous=FALSE;
|
||||
de.size=size;
|
||||
if (blk_count=(size+BLK_SIZE-1)>>BLK_SIZE_BITS)
|
||||
c=ClusAlloc(dv,0,(blk_count+dv->spc-1)/dv->spc,contiguous);
|
||||
c=ClusAlloc(drive,0,(blk_count+drive->spc-1)/drive->spc,contiguous);
|
||||
else
|
||||
c=0x0FFFFFFF;
|
||||
de.clus=c;
|
||||
de.attr=attr;
|
||||
de.datetime=cdt;
|
||||
if (blk_count)
|
||||
ClusBlkWrite(dv,buf,c,blk_count);
|
||||
FAT32DirNew(dv,cur_dir,&de,TRUE);
|
||||
ClusBlkWrite(drive,buf,c,blk_count);
|
||||
FAT32DirNew(drive,cur_dir,&de,TRUE);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
@ -832,7 +832,7 @@ I64 FAT32FileWrite(CDrive *dv,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
|
||||
CDirEntry *FAT32FilesFind(U8 *files_find_mask,
|
||||
I64 fuf_flags,CDirEntry *parent=NULL,I64 *_dir_size=NULL)
|
||||
{
|
||||
CDrive *dv=Fs->cur_dv;
|
||||
CDrive *drive=Fs->cur_dv;
|
||||
CFAT32DirEntry *buf;
|
||||
I64 attr,xsum=0,dir_size=0,sub_dir_size,
|
||||
cur_dir_clus,cur_dir_entry,entries_per_clus;
|
||||
@ -842,12 +842,12 @@ CDirEntry *FAT32FilesFind(U8 *files_find_mask,
|
||||
throw('FUF');
|
||||
try {
|
||||
MemSet(&long_name,0,sizeof(CDirEntry));
|
||||
DriveLock(dv);
|
||||
cur_dir_clus=Name2DirClus(dv,Fs->cur_dir);
|
||||
buf=MAlloc(BLK_SIZE*dv->spc);
|
||||
entries_per_clus=dv->spc<<FAT32_ENTRIES_BITS;
|
||||
ClusRead(dv,buf,cur_dir_clus,1);
|
||||
dir_size+=dv->spc*BLK_SIZE;
|
||||
DriveLock(drive);
|
||||
cur_dir_clus=Name2DirClus(drive,Fs->cur_dir);
|
||||
buf=MAlloc(BLK_SIZE*drive->spc);
|
||||
entries_per_clus=drive->spc<<FAT32_ENTRIES_BITS;
|
||||
ClusRead(drive,buf,cur_dir_clus,1);
|
||||
dir_size+=drive->spc*BLK_SIZE;
|
||||
cur_dir_entry=0;
|
||||
while (ch=*buf[cur_dir_entry].name) {
|
||||
attr=buf[cur_dir_entry].attr;
|
||||
@ -862,21 +862,21 @@ CDirEntry *FAT32FilesFind(U8 *files_find_mask,
|
||||
else
|
||||
MemSet(tmpde,0,sizeof(CDirEntry));
|
||||
if (FAT32CDirFill(tmpde,&buf[cur_dir_entry],
|
||||
dv->fat32_local_time_offset)) {
|
||||
drive->fat32_local_time_offset)) {
|
||||
tmpde->parent=parent;
|
||||
if (Bt(&fuf_flags,FUf_RECURSE) && attr&RS_ATTR_DIR &&
|
||||
*tmpde->name!='.') {
|
||||
tmpde->next=res;
|
||||
res=tmpde;
|
||||
tmpde->full_name=DirNameAbs(tmpde->name);
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (Cd(tmpde->name)) {
|
||||
tmpde->sub=FAT32FilesFind(files_find_mask,fuf_flags,
|
||||
tmpde,&sub_dir_size);
|
||||
tmpde->size=sub_dir_size;
|
||||
Cd("..");
|
||||
}
|
||||
DriveLock(dv);
|
||||
DriveLock(drive);
|
||||
} else {
|
||||
tmpde->full_name=FileNameAbs(tmpde->name);
|
||||
if ((attr&RS_ATTR_DIR || !Bt(&fuf_flags,FUf_JUST_DIRS)) &&
|
||||
@ -897,30 +897,30 @@ CDirEntry *FAT32FilesFind(U8 *files_find_mask,
|
||||
} else
|
||||
MemSet(&long_name,0,sizeof(CDirEntry));
|
||||
if (++cur_dir_entry==entries_per_clus) {
|
||||
cur_dir_clus=ClusNumNext(dv,cur_dir_clus);
|
||||
cur_dir_clus=ClusNumNext(drive,cur_dir_clus);
|
||||
if (cur_dir_clus==INVALID_CLUS)
|
||||
break;
|
||||
else {
|
||||
ClusRead(dv,buf,cur_dir_clus,1);
|
||||
dir_size+=dv->spc*BLK_SIZE;
|
||||
ClusRead(drive,buf,cur_dir_clus,1);
|
||||
dir_size+=drive->spc*BLK_SIZE;
|
||||
cur_dir_entry=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Free(buf);
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (_dir_size)
|
||||
*_dir_size=dir_size;
|
||||
return res;
|
||||
}
|
||||
|
||||
Bool FAT32MkDir(CDrive *dv,U8 *cur_dir,U8 *name,I64 entry_count)
|
||||
Bool FAT32MkDir(CDrive *drive,U8 *cur_dir,U8 *name,I64 entry_count)
|
||||
{
|
||||
I64 c,cur_dir_clus=Name2DirClus(dv,cur_dir),
|
||||
I64 c,cur_dir_clus=Name2DirClus(drive,cur_dir),
|
||||
//Rough estimate of size
|
||||
size=CeilU64((entry_count+2)<<FAT32_ENTRIES_BITS,dv->spc<<BLK_SIZE_BITS);
|
||||
size=CeilU64((entry_count+2)<<FAT32_ENTRIES_BITS,drive->spc<<BLK_SIZE_BITS);
|
||||
U8 *buf=CAlloc(size);
|
||||
CDirEntry d_native;
|
||||
CFAT32DirEntry *dFAT=buf;
|
||||
@ -936,7 +936,7 @@ Bool FAT32MkDir(CDrive *dv,U8 *cur_dir,U8 *name,I64 entry_count)
|
||||
d_native.clus=c;
|
||||
d_native.size=0;
|
||||
d_native.datetime=Now;
|
||||
FAT32DirFill(dFAT,&d_native,NULL,dv->fat32_local_time_offset);
|
||||
FAT32DirFill(dFAT,&d_native,NULL,drive->fat32_local_time_offset);
|
||||
dFAT++;
|
||||
|
||||
MemSet(&d_native,0,sizeof(CDirEntry));
|
||||
@ -947,8 +947,8 @@ Bool FAT32MkDir(CDrive *dv,U8 *cur_dir,U8 *name,I64 entry_count)
|
||||
d_native.clus=cur_dir_clus;
|
||||
d_native.size=0;
|
||||
d_native.datetime=Now;
|
||||
FAT32DirFill(dFAT,&d_native,NULL,dv->fat32_local_time_offset);
|
||||
ClusWrite(dv,buf,c,1);
|
||||
FAT32DirFill(dFAT,&d_native,NULL,drive->fat32_local_time_offset);
|
||||
ClusWrite(drive,buf,c,1);
|
||||
Free(buf);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
|
@ -1,41 +1,41 @@
|
||||
// See $LK,"RedSea File System",A="FI:::/Doc/RedSea.DD"$
|
||||
|
||||
U0 RedSeaFreeFreeList(CDrive *dv)
|
||||
U0 RedSeaFreeFreeList(CDrive *drive)
|
||||
{
|
||||
CFreeList *tmpf,*tmpf1;
|
||||
Bool unlock;
|
||||
try {
|
||||
unlock=DriveLock(dv);
|
||||
if (tmpf=dv->next_free) {
|
||||
while (tmpf!=&dv->next_free) {
|
||||
unlock=DriveLock(drive);
|
||||
if (tmpf=drive->next_free) {
|
||||
while (tmpf!=&drive->next_free) {
|
||||
tmpf1=tmpf->next;
|
||||
Free(tmpf);
|
||||
tmpf=tmpf1;
|
||||
}
|
||||
}
|
||||
dv->next_free=NULL;
|
||||
drive->next_free=NULL;
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
}
|
||||
|
||||
U0 RedSeaFreeListBuild(CDrive *dv)
|
||||
U0 RedSeaFreeListBuild(CDrive *drive)
|
||||
{
|
||||
Bool unlock;
|
||||
CFreeList *tmpf;
|
||||
I64 i,first=dv->data_area,max_blk=dv->size+dv->drv_offset;
|
||||
I64 i,first=drive->data_area,max_blk=drive->size+drive->drv_offset;
|
||||
try {
|
||||
unlock=DriveLock(dv);
|
||||
if (dv->next_free)
|
||||
RedSeaFreeFreeList(dv);
|
||||
QueueInit(&dv->next_free);
|
||||
unlock=DriveLock(drive);
|
||||
if (drive->next_free)
|
||||
RedSeaFreeFreeList(drive);
|
||||
QueueInit(&drive->next_free);
|
||||
while (first<max_blk) {
|
||||
i=0; //count free clus
|
||||
while (first+i<max_blk) {
|
||||
DriveFATBlkSet(dv,first+i);
|
||||
if (Bt(dv->cur_fat_blk,(first+i-dv->data_area)&(BLK_SIZE<<3-1)))
|
||||
DriveFATBlkSet(drive,first+i);
|
||||
if (Bt(drive->cur_fat_blk,(first+i-drive->data_area)&(BLK_SIZE<<3-1)))
|
||||
break;
|
||||
else
|
||||
i++;
|
||||
@ -44,47 +44,47 @@ U0 RedSeaFreeListBuild(CDrive *dv)
|
||||
tmpf=AMAlloc(sizeof(CFreeList));
|
||||
tmpf->size=i;
|
||||
tmpf->start=first;
|
||||
QueueInsert(tmpf,dv->last_free);
|
||||
QueueInsert(tmpf,drive->last_free);
|
||||
}
|
||||
first+=i+1;
|
||||
}
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
}
|
||||
|
||||
U0 RedSeaInit(CDrive *dv)
|
||||
U0 RedSeaInit(CDrive *drive)
|
||||
{
|
||||
CRedSeaBoot br;
|
||||
Bool unlock;
|
||||
try {
|
||||
unlock=DriveLock(dv);
|
||||
BlkRead(dv,&br,dv->drv_offset,1);
|
||||
unlock=DriveLock(drive);
|
||||
BlkRead(drive,&br,drive->drv_offset,1);
|
||||
if (br.signature!=MBR_PT_REDSEA || br.signature2!=0xAA55)
|
||||
throw('Drive');
|
||||
dv->fs_type=FSt_REDSEA;
|
||||
RedSeaFreeFreeList(dv);
|
||||
dv->spc=1;
|
||||
dv->size=br.sects;
|
||||
dv->data_area=dv->drv_offset+br.bitmap_sects;
|
||||
dv->root_clus=br.root_clus;
|
||||
dv->fat1=dv->fat2=dv->drv_offset+1;
|
||||
DriveFATBlkAlloc(dv);
|
||||
drive->fs_type=FSt_REDSEA;
|
||||
RedSeaFreeFreeList(drive);
|
||||
drive->spc=1;
|
||||
drive->size=br.sects;
|
||||
drive->data_area=drive->drv_offset+br.bitmap_sects;
|
||||
drive->root_clus=br.root_clus;
|
||||
drive->fat1=drive->fat2=drive->drv_offset+1;
|
||||
DriveFATBlkAlloc(drive);
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
}
|
||||
|
||||
Bool RedSeaValidate(U8 drv_let)
|
||||
{
|
||||
CDrive *dv;
|
||||
CDrive *drive;
|
||||
CRedSeaBoot br;
|
||||
if ((dv=Letter2Drive(drv_let,FALSE)) && dv->fs_type==FSt_REDSEA &&
|
||||
BlkRead(dv,&br,dv->drv_offset,1) && br.signature==MBR_PT_REDSEA &&
|
||||
if ((drive=Letter2Drive(drv_let,FALSE)) && drive->fs_type==FSt_REDSEA &&
|
||||
BlkRead(drive,&br,drive->drv_offset,1) && br.signature==MBR_PT_REDSEA &&
|
||||
br.signature2==0xAA55)
|
||||
return TRUE;
|
||||
else
|
||||
@ -96,17 +96,17 @@ U0 RedSeaFmt(U8 drv_let,Bool quick=TRUE)
|
||||
U8 *root_dir;
|
||||
CDirEntry *d_native;
|
||||
CRedSeaBoot *br=CAlloc(BLK_SIZE);
|
||||
CDrive *dv=Letter2Drive(drv_let);
|
||||
CDrive *drive=Letter2Drive(drv_let);
|
||||
I64 i,n,root_dir_blks;
|
||||
try {
|
||||
DriveLock(dv);
|
||||
DriveLock(drive);
|
||||
// DriveTypeSet(drv_let,FSt_REDSEA);
|
||||
DriveTypeSet(drv_let,FSt_FAT32);
|
||||
dv->fs_type=FSt_REDSEA;
|
||||
drive->fs_type=FSt_REDSEA;
|
||||
br->signature=MBR_PT_REDSEA;
|
||||
br->signature2=0xAA55;
|
||||
br->drv_offset=dv->drv_offset; //For CD/DVD image copy.
|
||||
br->sects=dv->size;
|
||||
br->drv_offset=drive->drv_offset; //For CD/DVD image copy.
|
||||
br->sects=drive->size;
|
||||
n=(br->sects+BLK_SIZE<<3-1)/BLK_SIZE<<3;
|
||||
br->bitmap_sects=n;
|
||||
br->unique_id=GetTSC^Now()(U64);
|
||||
@ -115,16 +115,16 @@ U0 RedSeaFmt(U8 drv_let,Bool quick=TRUE)
|
||||
if (quick)
|
||||
i=n+1;
|
||||
else
|
||||
i=dv->size;
|
||||
BlkWriteZero(dv,dv->drv_offset,i);
|
||||
i=drive->size;
|
||||
BlkWriteZero(drive,drive->drv_offset,i);
|
||||
|
||||
BlkWrite(dv,br,dv->drv_offset,1);
|
||||
RedSeaInit(dv);
|
||||
ClusAlloc(dv,0,1,FALSE); //Alloc #1
|
||||
BlkWrite(drive,br,drive->drv_offset,1);
|
||||
RedSeaInit(drive);
|
||||
ClusAlloc(drive,0,1,FALSE); //Alloc #1
|
||||
|
||||
root_dir_blks=MaxI64(1,dv->bd->init_root_dir_blks);
|
||||
br->root_clus=ClusAlloc(dv,0,root_dir_blks,FALSE);
|
||||
BlkWrite(dv,br,dv->drv_offset,1);
|
||||
root_dir_blks=MaxI64(1,drive->bd->init_root_dir_blks);
|
||||
br->root_clus=ClusAlloc(drive,0,root_dir_blks,FALSE);
|
||||
BlkWrite(drive,br,drive->drv_offset,1);
|
||||
root_dir=CAlloc(BLK_SIZE*root_dir_blks);
|
||||
|
||||
d_native=root_dir-offset(CDirEntry.start);
|
||||
@ -143,16 +143,16 @@ U0 RedSeaFmt(U8 drv_let,Bool quick=TRUE)
|
||||
d_native->clus=br->root_clus;
|
||||
d_native->datetime=Now;
|
||||
|
||||
BlkWrite(dv,root_dir,br->root_clus,root_dir_blks);
|
||||
RedSeaInit(dv);
|
||||
DriveUnlock(dv);
|
||||
BlkWrite(drive,root_dir,br->root_clus,root_dir_blks);
|
||||
RedSeaInit(drive);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
Free(br);
|
||||
Free(root_dir);
|
||||
}
|
||||
|
||||
Bool RedSeaFileFind(CDrive *dv,I64 cur_dir_clus,U8 *name,
|
||||
Bool RedSeaFileFind(CDrive *drive,I64 cur_dir_clus,U8 *name,
|
||||
CDirEntry *_res,I64 fuf_flags=0)
|
||||
{//$LK,"FUF_JUST_DIRS",A="MN:FUF_JUST_DIRS"$, $LK,"FUF_JUST_FILES",A="MN:FUF_JUST_FILES"$
|
||||
CDirEntry *buf,*buf2,*ptr;
|
||||
@ -162,20 +162,20 @@ Bool RedSeaFileFind(CDrive *dv,I64 cur_dir_clus,U8 *name,
|
||||
if (fuf_flags&~FUG_FILE_FIND)
|
||||
throw('FUF');
|
||||
MemSet(_res,0,sizeof(CDirEntry));
|
||||
DriveCheck(dv);
|
||||
if (dv->fs_type!=FSt_REDSEA)
|
||||
DriveCheck(drive);
|
||||
if (drive->fs_type!=FSt_REDSEA)
|
||||
PrintErr("Not RedSea Drive\n");
|
||||
else if (!CFileNameTo(dname,name))
|
||||
PrintErr("Invalid FileName: \"%s\".\n",name);
|
||||
else
|
||||
try {
|
||||
unlock=DriveLock(dv);
|
||||
unlock=DriveLock(drive);
|
||||
buf2=MAlloc(BLK_SIZE);
|
||||
BlkRead(dv,buf2,cur_dir_clus,1);
|
||||
BlkRead(drive,buf2,cur_dir_clus,1);
|
||||
|
||||
ptr=buf2(U8 *)-offset(CDirEntry.start);
|
||||
buf=MAlloc(ptr->size);
|
||||
BlkRead(dv,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
|
||||
BlkRead(drive,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
|
||||
Free(buf2);
|
||||
|
||||
ptr=buf(U8 *)-offset(CDirEntry.start);
|
||||
@ -197,39 +197,39 @@ Bool RedSeaFileFind(CDrive *dv,I64 cur_dir_clus,U8 *name,
|
||||
rsff_done:
|
||||
Free(buf);
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
return res;
|
||||
}
|
||||
|
||||
U8 *RedSeaFileRead(CDrive *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
|
||||
U8 *RedSeaFileRead(CDrive *drive,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
|
||||
{
|
||||
U8 *buf=NULL;
|
||||
CDirEntry de;
|
||||
I64 c,blk_count,cur_dir_clus;
|
||||
DriveCheck(dv);
|
||||
DriveCheck(drive);
|
||||
*_size=0;
|
||||
*_attr=0;
|
||||
if (dv->fs_type!=FSt_REDSEA)
|
||||
if (drive->fs_type!=FSt_REDSEA)
|
||||
PrintErr("Not RedSea Drive\n");
|
||||
else
|
||||
try {
|
||||
DriveLock(dv);
|
||||
cur_dir_clus=Name2DirClus(dv,cur_dir);
|
||||
if (RedSeaFileFind(dv,cur_dir_clus,filename,&de,FUF_JUST_FILES)) {
|
||||
DriveLock(drive);
|
||||
cur_dir_clus=Name2DirClus(drive,cur_dir);
|
||||
if (RedSeaFileFind(drive,cur_dir_clus,filename,&de,FUF_JUST_FILES)) {
|
||||
blk_count=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
buf=MAlloc(blk_count<<BLK_SIZE_BITS+1);
|
||||
c=de.clus;
|
||||
c=BlkRead(dv,buf,c,blk_count);
|
||||
c=BlkRead(drive,buf,c,blk_count);
|
||||
buf[de.size]=0; //Terminate
|
||||
*_size=de.size;
|
||||
*_attr=FileAttr(de.name,de.attr);
|
||||
}
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@ -245,22 +245,22 @@ Bool RedSeaCd(U8 *name,I64 cur_dir_clus)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
U0 RedSeaFreeClus(CDrive *dv,I64 c,I64 count)
|
||||
U0 RedSeaFreeClus(CDrive *drive,I64 c,I64 count)
|
||||
{
|
||||
CFreeList *tmpf;
|
||||
Bool found=FALSE,unlock,unlock_break;
|
||||
DriveCheck(dv);
|
||||
DriveCheck(drive);
|
||||
if (!c) return;
|
||||
if (dv->fs_type!=FSt_REDSEA)
|
||||
if (drive->fs_type!=FSt_REDSEA)
|
||||
PrintErr("Not RedSea Drive\n");
|
||||
else
|
||||
try {
|
||||
unlock_break=BreakLock;
|
||||
unlock=DriveLock(dv);
|
||||
if (!dv->next_free)
|
||||
RedSeaFreeListBuild(dv);
|
||||
tmpf=dv->next_free;
|
||||
while (!found && tmpf!=&dv->next_free) {
|
||||
unlock=DriveLock(drive);
|
||||
if (!drive->next_free)
|
||||
RedSeaFreeListBuild(drive);
|
||||
tmpf=drive->next_free;
|
||||
while (!found && tmpf!=&drive->next_free) {
|
||||
if (tmpf->start+tmpf->size==c) {
|
||||
tmpf->size+=count;
|
||||
found=TRUE;
|
||||
@ -275,29 +275,29 @@ U0 RedSeaFreeClus(CDrive *dv,I64 c,I64 count)
|
||||
tmpf=AMAlloc(sizeof(CFreeList));
|
||||
tmpf->size=count;
|
||||
tmpf->start=c;
|
||||
QueueInsert(tmpf,dv->last_free);
|
||||
QueueInsert(tmpf,drive->last_free);
|
||||
}
|
||||
while (count-->0) {
|
||||
DriveFATBlkSet(dv,c);
|
||||
LBtr(dv->cur_fat_blk,(c-dv->data_area)&(BLK_SIZE<<3-1));
|
||||
LBts(&dv->fat_blk_dirty,0);
|
||||
DriveFATBlkSet(drive,c);
|
||||
LBtr(drive->cur_fat_blk,(c-drive->data_area)&(BLK_SIZE<<3-1));
|
||||
LBts(&drive->fat_blk_dirty,0);
|
||||
c++;
|
||||
}
|
||||
DriveFATBlkClean(dv);
|
||||
DriveFATBlkClean(drive);
|
||||
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
} catch {
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
}
|
||||
}
|
||||
|
||||
I64 RedSeaAllocClus(CDrive *dv,I64 count)
|
||||
I64 RedSeaAllocClus(CDrive *drive,I64 count)
|
||||
{
|
||||
CFreeList *tmpf,*best_free=NULL;
|
||||
I64 i,first,best_size=I64_MAX;
|
||||
@ -306,11 +306,11 @@ I64 RedSeaAllocClus(CDrive *dv,I64 count)
|
||||
throw('Drive');
|
||||
try {
|
||||
unlock_break=BreakLock;
|
||||
unlock=DriveLock(dv);
|
||||
if (!dv->next_free)
|
||||
RedSeaFreeListBuild(dv);
|
||||
tmpf=dv->next_free;
|
||||
while (tmpf!=&dv->next_free) {
|
||||
unlock=DriveLock(drive);
|
||||
if (!drive->next_free)
|
||||
RedSeaFreeListBuild(drive);
|
||||
tmpf=drive->next_free;
|
||||
while (tmpf!=&drive->next_free) {
|
||||
if (tmpf->size>=count && tmpf->size<best_size) {
|
||||
best_free=tmpf;
|
||||
best_size=tmpf->size;
|
||||
@ -323,11 +323,11 @@ I64 RedSeaAllocClus(CDrive *dv,I64 count)
|
||||
throw('Drive');
|
||||
first=best_free->start;
|
||||
for (i=0;i<count;i++) {
|
||||
DriveFATBlkSet(dv,first+i);
|
||||
LBts(dv->cur_fat_blk,(first+i-dv->data_area)&(BLK_SIZE<<3-1));
|
||||
LBts(&dv->fat_blk_dirty,0);
|
||||
DriveFATBlkSet(drive,first+i);
|
||||
LBts(drive->cur_fat_blk,(first+i-drive->data_area)&(BLK_SIZE<<3-1));
|
||||
LBts(&drive->fat_blk_dirty,0);
|
||||
}
|
||||
DriveFATBlkClean(dv);
|
||||
DriveFATBlkClean(drive);
|
||||
if (best_free->size-=count)
|
||||
best_free->start+=count;
|
||||
else {
|
||||
@ -335,19 +335,19 @@ I64 RedSeaAllocClus(CDrive *dv,I64 count)
|
||||
Free(best_free);
|
||||
}
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
} catch {
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
}
|
||||
return first;
|
||||
}
|
||||
|
||||
Bool RedSeaDirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
Bool RedSeaDirNew(CDrive *drive,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
{
|
||||
CDirEntry *buf,*buf2,*ptr,de2;
|
||||
CRedSeaBoot *br;
|
||||
@ -357,14 +357,14 @@ Bool RedSeaDirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
try {
|
||||
unlock_break=BreakLock;
|
||||
tmpde->attr|=RS_ATTR_CONTIGUOUS;
|
||||
unlock=DriveLock(dv);
|
||||
cur_dir_clus=Name2DirClus(dv,cur_dir);
|
||||
unlock=DriveLock(drive);
|
||||
cur_dir_clus=Name2DirClus(drive,cur_dir);
|
||||
buf2=MAlloc(BLK_SIZE);
|
||||
BlkRead(dv,buf2,cur_dir_clus,1);
|
||||
BlkRead(drive,buf2,cur_dir_clus,1);
|
||||
|
||||
ptr=buf2(U8 *)-offset(CDirEntry.start);
|
||||
buf=MAlloc(ptr->size);
|
||||
BlkRead(dv,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
|
||||
BlkRead(drive,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
|
||||
|
||||
dir_size=ptr->size;
|
||||
ptr=buf(U8 *)-offset(CDirEntry.start)+CDIR_SIZE;
|
||||
@ -374,26 +374,26 @@ Bool RedSeaDirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
if (!written)
|
||||
MemCpy(&ptr->start,&tmpde->start,CDIR_SIZE);
|
||||
if ((i+1)*CDIR_SIZE+j<<BLK_SIZE_BITS<dir_size)
|
||||
BlkWrite(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
|
||||
BlkWrite(drive,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
|
||||
else {
|
||||
buf2=CAlloc(dir_size+BLK_SIZE);
|
||||
MemCpy(buf2,buf,dir_size);
|
||||
RedSeaFreeClus(dv,cur_dir_clus,dir_size>>BLK_SIZE_BITS);
|
||||
RedSeaFreeClus(drive,cur_dir_clus,dir_size>>BLK_SIZE_BITS);
|
||||
dir_size+=BLK_SIZE;
|
||||
c=ClusAlloc(dv,0,dir_size>>BLK_SIZE_BITS,TRUE);
|
||||
c=ClusAlloc(drive,0,dir_size>>BLK_SIZE_BITS,TRUE);
|
||||
Free(buf);
|
||||
buf=buf2;
|
||||
ptr=buf(U8 *)-offset(CDirEntry.start);
|
||||
ptr->size=dir_size;
|
||||
ptr->clus=c;
|
||||
BlkWrite(dv,buf,c,dir_size>>BLK_SIZE_BITS);
|
||||
if (cur_dir_clus==dv->root_clus) {
|
||||
BlkWrite(drive,buf,c,dir_size>>BLK_SIZE_BITS);
|
||||
if (cur_dir_clus==drive->root_clus) {
|
||||
br=CAlloc(BLK_SIZE);
|
||||
BlkRead(dv,br,dv->drv_offset,1);
|
||||
BlkRead(drive,br,drive->drv_offset,1);
|
||||
br->root_clus=c;
|
||||
BlkWrite(dv,br,dv->drv_offset,1);
|
||||
BlkWrite(drive,br,drive->drv_offset,1);
|
||||
Free(br);
|
||||
dv->root_clus=c;
|
||||
drive->root_clus=c;
|
||||
} else {
|
||||
tmp=StrNew(cur_dir);
|
||||
parent_dir=StrNew(cur_dir);
|
||||
@ -402,11 +402,11 @@ Bool RedSeaDirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
Free(parent_dir);
|
||||
parent_dir=StrNew("/");
|
||||
}
|
||||
if (RedSeaFileFind(dv,Name2DirClus(dv,parent_dir),
|
||||
if (RedSeaFileFind(drive,Name2DirClus(drive,parent_dir),
|
||||
tmp,&de2,FUF_JUST_DIRS)) {
|
||||
de2.clus=c;
|
||||
de2.size=dir_size;
|
||||
RedSeaDirNew(dv,parent_dir,&de2,FALSE);
|
||||
RedSeaDirNew(drive,parent_dir,&de2,FALSE);
|
||||
} else
|
||||
throw('Drive');
|
||||
Free(tmp);
|
||||
@ -417,19 +417,19 @@ Bool RedSeaDirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
} else if (ptr->attr & RS_ATTR_DELETED) {
|
||||
if (!written) {
|
||||
MemCpy(&ptr->start,&tmpde->start,CDIR_SIZE);
|
||||
BlkWrite(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
|
||||
BlkWrite(drive,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
|
||||
written=TRUE;
|
||||
}
|
||||
} else {
|
||||
if (!StrCmp(tmpde->name,ptr->name)) {
|
||||
if (free_old_chain)
|
||||
RedSeaFreeClus(dv,ptr->clus,
|
||||
RedSeaFreeClus(drive,ptr->clus,
|
||||
(ptr->size+BLK_SIZE-1)>>BLK_SIZE_BITS);
|
||||
if (!written)
|
||||
MemCpy(&ptr->start,&tmpde->start,CDIR_SIZE);
|
||||
else
|
||||
ptr->attr|=RS_ATTR_DELETED;
|
||||
BlkWrite(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
|
||||
BlkWrite(drive,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -441,19 +441,19 @@ Bool RedSeaDirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
}
|
||||
Free(buf);
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
} catch {
|
||||
if (unlock)
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
I64 RedSeaFilesDel(CDrive *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
I64 RedSeaFilesDel(CDrive *drive,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
Bool del_dir,Bool print_message)
|
||||
{
|
||||
CDirEntry *buf,*buf2,*ptr;
|
||||
@ -461,14 +461,14 @@ I64 RedSeaFilesDel(CDrive *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
Bool unlock_break;
|
||||
try {
|
||||
unlock_break=BreakLock;
|
||||
DriveLock(dv);
|
||||
cur_dir_clus=Name2DirClus(dv,cur_dir);
|
||||
DriveLock(drive);
|
||||
cur_dir_clus=Name2DirClus(drive,cur_dir);
|
||||
buf2=MAlloc(BLK_SIZE);
|
||||
BlkRead(dv,buf2,cur_dir_clus,1);
|
||||
BlkRead(drive,buf2,cur_dir_clus,1);
|
||||
|
||||
ptr=buf2(U8 *)-offset(CDirEntry.start);
|
||||
buf=MAlloc(ptr->size);
|
||||
BlkRead(dv,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
|
||||
BlkRead(drive,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
|
||||
Free(buf2);
|
||||
|
||||
ptr=buf(U8 *)-offset(CDirEntry.start);
|
||||
@ -484,8 +484,8 @@ I64 RedSeaFilesDel(CDrive *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
if (print_message)
|
||||
"Del %s\n",ptr->name;
|
||||
ptr->attr|=RS_ATTR_DELETED;
|
||||
BlkWrite(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
|
||||
RedSeaFreeClus(dv,ptr->clus,
|
||||
BlkWrite(drive,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
|
||||
RedSeaFreeClus(drive,ptr->clus,
|
||||
(ptr->size+BLK_SIZE-1)>>BLK_SIZE_BITS);
|
||||
}
|
||||
ptr(U8 *)+=CDIR_SIZE;
|
||||
@ -495,41 +495,41 @@ I64 RedSeaFilesDel(CDrive *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
}
|
||||
}
|
||||
Free(buf);
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
} catch {
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 RedSeaFileWrite(CDrive *dv,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
|
||||
I64 RedSeaFileWrite(CDrive *drive,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
|
||||
CDate cdt,I64 attr)
|
||||
{
|
||||
CDirEntry de;
|
||||
I64 c=0,blk_count;
|
||||
MemSet(&de,0,sizeof(CDirEntry));
|
||||
if (size<0) size=0;
|
||||
if (dv->fs_type!=FSt_REDSEA)
|
||||
if (drive->fs_type!=FSt_REDSEA)
|
||||
PrintErr("Not RedSea Drive\n");
|
||||
else if (!CFileNameTo(de.name,name))
|
||||
PrintErr("Invalid FileName: \"%s\".\n",name);
|
||||
else {
|
||||
RedSeaFilesDel(dv,cur_dir,de.name,0,FALSE,FALSE);
|
||||
RedSeaFilesDel(drive,cur_dir,de.name,0,FALSE,FALSE);
|
||||
de.size=size;
|
||||
if (blk_count=(size+BLK_SIZE-1)>>BLK_SIZE_BITS)
|
||||
c=ClusAlloc(dv,0,blk_count,TRUE); //Always contiguous
|
||||
c=ClusAlloc(drive,0,blk_count,TRUE); //Always contiguous
|
||||
else
|
||||
c=INVALID_CLUS;
|
||||
de.clus=c;
|
||||
de.attr=attr|RS_ATTR_CONTIGUOUS;
|
||||
de.datetime=cdt;
|
||||
if (blk_count)
|
||||
BlkWrite(dv,buf,c,blk_count);
|
||||
RedSeaDirNew(dv,cur_dir,&de,TRUE);
|
||||
BlkWrite(drive,buf,c,blk_count);
|
||||
RedSeaDirNew(drive,cur_dir,&de,TRUE);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
@ -537,27 +537,27 @@ I64 RedSeaFileWrite(CDrive *dv,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
|
||||
CDirEntry *RedSeaFilesFind(U8 *files_find_mask,I64 fuf_flags,
|
||||
CDirEntry *parent=NULL)
|
||||
{
|
||||
CDrive *dv=Fs->cur_dv;
|
||||
CDrive *drive=Fs->cur_dv;
|
||||
CDirEntry *buf,*buf2,*ptr,*res=NULL,*tmpde;
|
||||
I64 ch,cur_dir_clus;
|
||||
if (fuf_flags&~FUG_FILES_FIND)
|
||||
throw('FUF');
|
||||
try {
|
||||
DriveLock(dv);
|
||||
cur_dir_clus=Name2DirClus(dv,Fs->cur_dir);
|
||||
DriveLock(drive);
|
||||
cur_dir_clus=Name2DirClus(drive,Fs->cur_dir);
|
||||
buf2=MAlloc(BLK_SIZE);
|
||||
BlkRead(dv,buf2,cur_dir_clus,1);
|
||||
BlkRead(drive,buf2,cur_dir_clus,1);
|
||||
|
||||
ptr=buf2(U8 *)-offset(CDirEntry.start);
|
||||
buf=MAlloc(ptr->size);
|
||||
BlkRead(dv,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
|
||||
BlkRead(drive,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
|
||||
Free(buf2);
|
||||
|
||||
ptr=buf(U8 *)-offset(CDirEntry.start);
|
||||
*ptr->name='.';
|
||||
ptr->name[1]=0;
|
||||
ptr(U8 *)+=CDIR_SIZE;
|
||||
ptr->clus=Name2ParentDirClus(dv,Fs->cur_dir);
|
||||
ptr->clus=Name2ParentDirClus(drive,Fs->cur_dir);
|
||||
ptr(U8 *)-=CDIR_SIZE;
|
||||
while (TRUE) {
|
||||
if (!(ch=*ptr->name))
|
||||
@ -571,12 +571,12 @@ CDirEntry *RedSeaFilesFind(U8 *files_find_mask,I64 fuf_flags,
|
||||
tmpde->next=res;
|
||||
res=tmpde;
|
||||
tmpde->full_name=DirNameAbs(tmpde->name);
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
if (Cd(tmpde->name)) {
|
||||
tmpde->sub=RedSeaFilesFind(files_find_mask,fuf_flags,tmpde);
|
||||
Cd("..");
|
||||
}
|
||||
DriveLock(dv);
|
||||
DriveLock(drive);
|
||||
} else {
|
||||
tmpde->full_name=FileNameAbs(tmpde->name);
|
||||
if ((tmpde->attr&RS_ATTR_DIR ||
|
||||
@ -593,15 +593,15 @@ CDirEntry *RedSeaFilesFind(U8 *files_find_mask,I64 fuf_flags,
|
||||
ptr(U8 *)+=CDIR_SIZE;
|
||||
}
|
||||
Free(buf);
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
} catch
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
return res;
|
||||
}
|
||||
|
||||
Bool RedSeaMkDir(CDrive *dv,U8 *cur_dir,U8 *name,I64 entry_count)
|
||||
Bool RedSeaMkDir(CDrive *drive,U8 *cur_dir,U8 *name,I64 entry_count)
|
||||
{//entry_count is for preallocating dir blks.
|
||||
I64 c,cur_dir_clus=Name2DirClus(dv,cur_dir),
|
||||
I64 c,cur_dir_clus=Name2DirClus(drive,cur_dir),
|
||||
size=CeilU64((entry_count+3)<<6,BLK_SIZE);
|
||||
#assert CDIR_SIZE==64
|
||||
U8 *buf=CAlloc(size);
|
||||
@ -624,7 +624,7 @@ Bool RedSeaMkDir(CDrive *dv,U8 *cur_dir,U8 *name,I64 entry_count)
|
||||
d_native->clus=cur_dir_clus;
|
||||
d_native->size=0;
|
||||
d_native->datetime=Now;
|
||||
BlkWrite(dv,buf,c,1);
|
||||
BlkWrite(drive,buf,c,1);
|
||||
Free(buf);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
|
@ -19,13 +19,13 @@ U8 *kernel_cfg_options="MemInit\0HeapInit\0VarInit\0StaffMode\0"
|
||||
|
||||
class CKCfg
|
||||
{
|
||||
U8 *dsk_cache_size_exp;
|
||||
U8 *disk_cache_size_exp;
|
||||
CDoc *add_dev;
|
||||
U8 *dbg_distro_file,*dbg_distro_start;
|
||||
U8 *home_dir;
|
||||
Bool opts[CFG_OPTIONS_NUM];
|
||||
U8 mem_init_val,heap_init_val,var_init_val,
|
||||
boot_drv_let,mount_ide_auto_hd_let,mount_ide_auto_cd_let;
|
||||
boot_drive_let,mount_ide_auto_hd_let,mount_ide_auto_cd_let;
|
||||
};
|
||||
|
||||
CDoc *KCfgAddDev(CKCfg *c)
|
||||
@ -38,12 +38,12 @@ CDoc *KCfgAddDev(CKCfg *c)
|
||||
"\n($$PURPLE$$<ENTER>$$FG$$ for cur drv) Boot Drive:";
|
||||
ch=Letter2Letter(GetChar);
|
||||
if ('A'<=ch<='Z')
|
||||
c->boot_drv_let=ch;
|
||||
c->boot_drive_let=ch;
|
||||
else
|
||||
c->boot_drv_let=Drive2Letter(Fs->cur_dv);
|
||||
c->boot_drive_let=Drive2Letter(Fs->cur_dv);
|
||||
"\n\n$$BK,1$$$$PURPLE$$Mount drives so they will be present when "
|
||||
"you boot.$$FG$$$$BK,0$$\n";
|
||||
Mount2(c->boot_drv_let,doc,FALSE);
|
||||
Mount2(c->boot_drive_let,doc,FALSE);
|
||||
return doc;
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ U0 KCfgOptions(CKCfg *c)
|
||||
"$$PURPLE$$%13tz$$FG$$:%Z\n",i,kernel_cfg_options,c->opts[i],"ST_OFF_ON";
|
||||
"\nType '$$PURPLE$$Help$$FG$$' for help.\n";
|
||||
st=GetStr("Option ($$PURPLE$$<ENTER>$$FG$$ when done):","");
|
||||
i=ListMatch(st,kernel_cfg_options,LMF_IGNORE_CASE);
|
||||
i=ListMatch(st,kernel_cfg_options,LMF_IGNORE_CASE);
|
||||
if (i==CFG_HELP)
|
||||
"\n"
|
||||
"$$PURPLE$$MemInit$$FG$$ Initializes memory above 0x100000 "
|
||||
@ -154,7 +154,7 @@ CKCfg *KCfgNew()
|
||||
|
||||
c->add_dev=KCfgAddDev(c);
|
||||
c->home_dir=StrNew("::/Home");
|
||||
c->dsk_cache_size_exp=GetStr(
|
||||
c->disk_cache_size_exp=GetStr(
|
||||
"Disk Cache Size in Bytes,\n"
|
||||
"gets rounded-up funny,\n"
|
||||
"($$PURPLE$$<ENTER>$$FG$$ will use default.):",
|
||||
@ -168,6 +168,6 @@ U0 KCfgDel(CKCfg *c)
|
||||
DocDel(c->add_dev);
|
||||
Free(c->dbg_distro_file);
|
||||
Free(c->home_dir);
|
||||
Free(c->dsk_cache_size_exp);
|
||||
Free(c->disk_cache_size_exp);
|
||||
Free(c);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ U0 SysDefinesLoad()
|
||||
"D\0F\0T\0$$\0S\0A\0J\0G\0Z\0O\0P\0f\0l\0lb\0la\0");
|
||||
DefineListLoad("ST_BLKDEV_TYPES",
|
||||
"NULL\0RAM\0ATA\0FILE_READ\0FILE_WRITE\0ATAPI\0");
|
||||
DefineListLoad("ST_DRV_TYPES",
|
||||
DefineListLoad("ST_DRIVE_TYPES",
|
||||
"NULL\0REDSEA\0FAT32\0ISO9660\0NTFS\0UNKNOWN\0");
|
||||
DefineListLoad("ST_COLORS","BLACK\0BLUE\0GREEN\0CYAN\0"
|
||||
"RED\0PURPLE\0BROWN\0LTGRAY\0DKGRAY\0LTBLUE\0LTGREEN\0"
|
||||
|
@ -13,14 +13,14 @@ extern U0 ZenithErr(U8 *fmt,...);
|
||||
extern U0 ZenithLog(U8 *fmt,...);
|
||||
extern I64 BIOSTotalMem();
|
||||
extern I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
|
||||
Bool whole_drv,Bool make_free);
|
||||
Bool whole_drive,Bool make_free);
|
||||
extern CBlkDev *BlkDevCheck(CBlkDev *bd,Bool except=TRUE);
|
||||
extern Bool BlkDevLock(CBlkDev *bd);
|
||||
extern CBlkDev *BlkDevNextFreeSlot(U8 first_drv_let,I64 type);
|
||||
extern CBlkDev *BlkDevNextFreeSlot(U8 first_drive_let,I64 type);
|
||||
extern Bool BlkDevUnlock(CBlkDev *bd,Bool reset=FALSE);
|
||||
extern U0 BlkDevsRelease();
|
||||
extern Bool BlkRead(CDrive *dv,U8 *buf, I64 blk, I64 count);
|
||||
extern Bool BlkWrite(CDrive *dv,U8 *buf, I64 blk, I64 count);
|
||||
extern Bool BlkRead(CDrive *drive,U8 *buf, I64 blk, I64 count);
|
||||
extern Bool BlkWrite(CDrive *drive,U8 *buf, I64 blk, I64 count);
|
||||
extern U8 *Caller(I64 num=1);
|
||||
extern U8 *CatPrint(U8 *_dst,U8 *fmt,...);
|
||||
extern Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE);
|
||||
@ -32,22 +32,22 @@ extern I64 Del(U8 *files_find_mask,Bool make_mask=FALSE,
|
||||
Bool del_dir=FALSE,Bool print_message=TRUE);
|
||||
extern Bool DirMk(U8 *filename,I64 entry_count=0);
|
||||
extern Bool Drive(U8 drv_let);
|
||||
extern U8 Drive2Letter(CDrive *dv=NULL);
|
||||
extern U8 Drive2Letter(CDrive *drive=NULL);
|
||||
extern U0 DriveBlkDevDel(CBlkDev *bd);
|
||||
extern CDrive *DriveCheck(CDrive *dv,Bool except=TRUE);
|
||||
extern CDrive *DriveCheck(CDrive *drive,Bool except=TRUE);
|
||||
extern U8 DriveTextAttrGet(U8 drv_let=0);
|
||||
extern Bool DriveTypeSet(U8 drv_let,I64 type=FSt_REDSEA);
|
||||
extern U0 DrivesRelease();
|
||||
extern U0 DiskCacheInvalidate(CDrive *dv);
|
||||
extern U0 DiskCacheInvalidate(CDrive *drive);
|
||||
extern U0 Exit();
|
||||
extern U8 *ExtDefault(U8 *filename,U8 *extension);
|
||||
extern I64 FAT32AllocClus(CDrive *dv,I64 c,I64 count);
|
||||
extern I64 FAT32AllocContiguousClus(CDrive *dv,I64 count);
|
||||
extern Bool FAT32DirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,
|
||||
extern I64 FAT32AllocClus(CDrive *drive,I64 c,I64 count);
|
||||
extern I64 FAT32AllocContiguousClus(CDrive *drive,I64 count);
|
||||
extern Bool FAT32DirNew(CDrive *drive,U8 *cur_dir,CDirEntry *tmpde,
|
||||
Bool free_old_chain);
|
||||
extern Bool FAT32FileFind(CDrive *dv,I64 cur_dir_clus,U8 *name,
|
||||
extern Bool FAT32FileFind(CDrive *drive,I64 cur_dir_clus,U8 *name,
|
||||
CDirEntry *_res,I64 fuf_flags=0);
|
||||
extern U0 FAT32Init(CDrive *dv);
|
||||
extern U0 FAT32Init(CDrive *drive);
|
||||
extern Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 count=1);
|
||||
extern Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 count=1);
|
||||
extern U0 FClose(CFile *f);
|
||||
@ -62,7 +62,7 @@ extern I64 GetChar(I64 *_scan_code=NULL,Bool echo=TRUE,Bool raw_cursor=FALSE);
|
||||
extern I64 GetS(U8 *buf,I64 size,Bool allow_ext=TRUE);
|
||||
extern CHeapCtrl *HeapCtrlInit(CHeapCtrl *hc=NULL,
|
||||
CTask *task=NULL,CBlkPool *bp);
|
||||
extern Bool ISOInit(CDrive *dv,I64 blk);
|
||||
extern Bool ISOInit(CDrive *drive,I64 blk);
|
||||
extern Bool IsDebugMode();
|
||||
extern Bool IsDir(U8 *dir_name);
|
||||
extern Bool IsRaw();
|
||||
@ -83,14 +83,14 @@ extern I64 PopUp(U8 *buf,CTask *parent=NULL,CTask **_pu_task=NULL);
|
||||
extern U0 Print(U8 *fmt,...);
|
||||
extern U0 PutChars(U64 ch);
|
||||
extern U0 PutS(U8 *st); //Use $LK,"Print",A="MN:Print"$()
|
||||
extern I64 RedSeaAllocClus(CDrive *dv,I64 count);
|
||||
extern Bool RedSeaDirNew(CDrive *dv,U8 *cur_dir,CDirEntry *tmpde,
|
||||
extern I64 RedSeaAllocClus(CDrive *drive,I64 count);
|
||||
extern Bool RedSeaDirNew(CDrive *drive,U8 *cur_dir,CDirEntry *tmpde,
|
||||
Bool free_old_chain);
|
||||
extern Bool RedSeaFileFind(CDrive *dv,I64 cur_dir_clus,U8 *name,
|
||||
extern Bool RedSeaFileFind(CDrive *drive,I64 cur_dir_clus,U8 *name,
|
||||
CDirEntry *_res,I64 fuf_flags=0);
|
||||
extern U0 RedSeaFmt(U8 drv_let,Bool quick=TRUE);
|
||||
extern U0 RedSeaFreeFreeList(CDrive *dv);
|
||||
extern U0 RedSeaInit(CDrive *dv);
|
||||
extern U0 RedSeaFreeFreeList(CDrive *drive);
|
||||
extern U0 RedSeaInit(CDrive *drive);
|
||||
extern Bool RedSeaValidate(U8 drv_let);
|
||||
extern CTask *SpawnQueue(U0 (*fp_addr)(U8 *data),U8 *data=NULL,
|
||||
U8 *task_name=NULL,I64 target_cpu,CTask *parent=NULL, //NULL means zenith
|
@ -18,9 +18,9 @@ U0 SysGlobalsInit()
|
||||
kernel_cfg->mount_ide_auto_hd_let='C';
|
||||
if (!kernel_cfg->mount_ide_auto_cd_let)
|
||||
kernel_cfg->mount_ide_auto_cd_let='T';
|
||||
StreamPrint("blkdev.first_hd_drv_let=%d;",
|
||||
StreamPrint("blkdev.first_hd_drive_let=%d;",
|
||||
kernel_cfg->mount_ide_auto_hd_let);
|
||||
StreamPrint("blkdev.first_dvd_drv_let=%d;",
|
||||
StreamPrint("blkdev.first_dvd_drive_let=%d;",
|
||||
kernel_cfg->mount_ide_auto_cd_let);
|
||||
}
|
||||
|
||||
@ -38,9 +38,9 @@ U0 SysGlobalsInit()
|
||||
KeyDevInit;
|
||||
|
||||
#exe {
|
||||
StreamPrint("blkdev.boot_drv_let='%C';",kernel_cfg->boot_drv_let);
|
||||
StreamPrint("blkdev.boot_drive_let='%C';",kernel_cfg->boot_drive_let);
|
||||
StreamPrint("#exe{Option(OPTf_WARN_PAREN,OFF);}");
|
||||
StreamPrint("DiskCacheInit(%s);",kernel_cfg->dsk_cache_size_exp);
|
||||
StreamPrint("DiskCacheInit(%s);",kernel_cfg->disk_cache_size_exp);
|
||||
StreamPrint("#exe{Option(OPTf_WARN_PAREN,ON);}");
|
||||
};
|
||||
|
||||
@ -173,15 +173,15 @@ U0 KMain()
|
||||
|
||||
TimeCal;
|
||||
BlkDevsInitAll;
|
||||
"DiskChg(':');\n";
|
||||
DiskChg(':');
|
||||
"DiskChange(':');\n";
|
||||
DiskChange(':');
|
||||
#exe {
|
||||
StreamPrint("HomeSet(\"%s\");\n"
|
||||
"blkdev.ins_base0=%d;blkdev.ins_base1=%d;blkdev.ins_unit =%d;\n",
|
||||
kernel_cfg->home_dir,
|
||||
blkdev.ins_base0,blkdev.ins_base1,blkdev.ins_unit);
|
||||
}
|
||||
Gs->idle_task->cur_dv=blkdev.let_to_drv[*blkdev.home_dir-'A'];
|
||||
Gs->idle_task->cur_dv=blkdev.let_to_drive[*blkdev.home_dir-'A'];
|
||||
DriveRep;
|
||||
if (blkdev.dvd_boot_is_good) {
|
||||
bd=Letter2BlkDev(':');
|
||||
|
@ -53,12 +53,12 @@ GDT_TR_RING3: DU8 MP_PROCESSORS_NUM*16 DUP(0);
|
||||
|
||||
//************************************
|
||||
CORE0_16BIT_INIT::
|
||||
//EAX is $LK,"SYS_BOOT_SRC",A="FF:::/Kernel/KStart16.HC,[SYS_BOOT_SRC]"$. (Val passed from boot blk, $LK,"BootHD",A="FF:::/Zenith/Boot/BootHD.HC,BOOT_SRC_HARDDRV"$, $LK,"BootDVD",A="FF:::/Zenith/Boot/BootDVD.HC,BOOT_SRC_DVD"$, & $LK,"BootRAM",A="FF:::/Zenith/Boot/BootRAM.HC,BOOT_SRC_RAM"$.)
|
||||
//EAX is $LK,"SYS_BOOT_SRC",A="FF:::/Kernel/KStart16.HC,[SYS_BOOT_SRC]"$. (Val passed from boot blk, $LK,"BootHD",A="FF:::/Zenith/Boot/BootHD.HC,BOOT_SRC_HARDDRIVE"$, $LK,"BootDVD",A="FF:::/Zenith/Boot/BootDVD.HC,BOOT_SRC_DVD"$, & $LK,"BootRAM",A="FF:::/Zenith/Boot/BootRAM.HC,BOOT_SRC_RAM"$.)
|
||||
MOV ECX,EAX
|
||||
MOV AX,(BOOT_RAM_LIMIT-BOOT_STACK_SIZE)/16
|
||||
MOV SS,AX
|
||||
MOV SP,BOOT_STACK_SIZE
|
||||
PUSH ECX //Will be $LK,"SYS_BOOT_SRC",A="FF:::/Kernel/KStart16.HC,[SYS_BOOT_SRC]"$. See $LK,"BootHD",A="FF:::/Zenith/Boot/BootHD.HC,BOOT_SRC_HARDDRV"$, $LK,"BootDVD",A="FF:::/Zenith/Boot/BootDVD.HC,BOOT_SRC_DVD"$ & $LK,"BootRAM",A="FF:::/Zenith/Boot/BootRAM.HC,BOOT_SRC_RAM"$.
|
||||
PUSH ECX //Will be $LK,"SYS_BOOT_SRC",A="FF:::/Kernel/KStart16.HC,[SYS_BOOT_SRC]"$. See $LK,"BootHD",A="FF:::/Zenith/Boot/BootHD.HC,BOOT_SRC_HARDDRIVE"$, $LK,"BootDVD",A="FF:::/Zenith/Boot/BootDVD.HC,BOOT_SRC_DVD"$ & $LK,"BootRAM",A="FF:::/Zenith/Boot/BootRAM.HC,BOOT_SRC_RAM"$.
|
||||
PUSH EBX
|
||||
|
||||
CALL U16 GET_RIP
|
||||
@ -162,7 +162,7 @@ GET_RIP: POP BX
|
||||
OUT 0x92,AL
|
||||
|
||||
POP U32 [SYS_BOOT_BLK]
|
||||
POP U32 [SYS_BOOT_SRC] //See $LK,"BootHD",A="FF:::/Zenith/Boot/BootHD.HC,BOOT_SRC_HARDDRV"$, $LK,"BootDVD",A="FF:::/Zenith/Boot/BootDVD.HC,BOOT_SRC_DVD"$, & $LK,"BootRAM",A="FF:::/Zenith/Boot/BootRAM.HC,BOOT_SRC_RAM"$.
|
||||
POP U32 [SYS_BOOT_SRC] //See $LK,"BootHD",A="FF:::/Zenith/Boot/BootHD.HC,BOOT_SRC_HARDDRIVE"$, $LK,"BootDVD",A="FF:::/Zenith/Boot/BootDVD.HC,BOOT_SRC_DVD"$, & $LK,"BootRAM",A="FF:::/Zenith/Boot/BootRAM.HC,BOOT_SRC_RAM"$.
|
||||
|
||||
CLD
|
||||
XOR EAX,EAX
|
||||
|
@ -228,8 +228,8 @@ I64 TaskInit(CTask *task,I64 stack_size)
|
||||
task->win_top =13;
|
||||
task->win_bottom =text.rows-2;
|
||||
|
||||
if (blkdev.home_dir) {//Beware Zenith $LK,"TaskInit",A="FF:::/Kernel/KStart64.HC,TaskInit"$. I guess ok until $LK,"DiskChg",A="FF:::/Kernel/KMain.HC,DiskChg"$().
|
||||
task->cur_dv=blkdev.let_to_drv[*blkdev.home_dir-'A'];
|
||||
if (blkdev.home_dir) {//Beware Zenith $LK,"TaskInit",A="FF:::/Kernel/KStart64.HC,TaskInit"$. I guess ok until $LK,"DiskChange",A="FF:::/Kernel/KMain.HC,DiskChange"$().
|
||||
task->cur_dv=blkdev.let_to_drive[*blkdev.home_dir-'A'];
|
||||
task->cur_dir=StrNew(blkdev.home_dir+2,task);
|
||||
} else
|
||||
task->cur_dir=StrNew("/Home",task);
|
||||
|
File diff suppressed because one or more lines are too long
@ -23,12 +23,12 @@
|
||||
#exe {Option(OPTf_EXTERNS_TO_IMPORTS,OFF);};
|
||||
#exe {Option(OPTf_KEEP_PRIVATE,OFF);};
|
||||
#include "KernelB.HH"
|
||||
#include "KExts"
|
||||
#include "KExterns"
|
||||
#include "StrA"
|
||||
#include "KGlobals"
|
||||
#include "KMathB"
|
||||
#include "Sched"
|
||||
#include "Mem/MakeMem"
|
||||
#include "Mem/MakeMem"
|
||||
#include "FontStd"
|
||||
#include "FontCyrillic"
|
||||
#include "StrB"
|
||||
|
@ -619,7 +619,7 @@ class CSema
|
||||
#define SEMA_REFRESH_IN_PROGRESS 8
|
||||
#define SEMA_FLUSH_VGA_IMAGE 9
|
||||
#define SEMA_SINGLE_USER 10
|
||||
#define SEMA_DSK_CACHE 11
|
||||
#define SEMA_DISK_CACHE 11
|
||||
#define SEMA_FAR_CALL32 12
|
||||
#define SEMA_DEV_MEM 13
|
||||
#define SEMA_VGA 14
|
||||
@ -2311,7 +2311,7 @@ public class CATARep
|
||||
#define DVD_BOOT_LOADER_SIZE DVD_BLK_SIZE*1
|
||||
#define INVALID_CLUS (-1)
|
||||
|
||||
class CMBRPrt
|
||||
class CMBRPart
|
||||
{
|
||||
U8 active, //0x80=active 0x00=inactive
|
||||
start_head;
|
||||
@ -2328,7 +2328,7 @@ class CMasterBoot
|
||||
U8 code[440];
|
||||
U32 media_id;
|
||||
U16 zero;
|
||||
CMBRPrt p[4];
|
||||
CMBRPart p[4];
|
||||
U16 signature; //AA55
|
||||
};
|
||||
|
||||
@ -2354,7 +2354,7 @@ class CFAT32Boot
|
||||
U16 reserved_sects;
|
||||
U8 copies_of_fat;
|
||||
U16 max_root_dir_entries, //Not used
|
||||
old_sects_in_drv; //Not used
|
||||
old_sects_in_drive; //Not used
|
||||
U8 media_desc; //F64 for hard disk
|
||||
U16 old_sects_per_fat, //Not used
|
||||
sects_per_track,
|
||||
@ -2368,7 +2368,7 @@ class CFAT32Boot
|
||||
U16 file_system_info_sect,
|
||||
backup_boot_sect;
|
||||
U8 reserved[12],
|
||||
log_drv_num,
|
||||
log_drive_num,
|
||||
unused,
|
||||
ext_signature; //0x29
|
||||
U32 serial_num;
|
||||
@ -2462,7 +2462,7 @@ class CATAPITrack
|
||||
#define ISOT_BOOT_RECORD 0
|
||||
#define ISOT_PRI_VOL_DESC 1
|
||||
#define ISOT_SUPPLEMENTARY_DESC 2
|
||||
#define ISOT_VOL_DRV_DESC 3
|
||||
#define ISOT_VOL_DRIVE_DESC 3
|
||||
#define ISOT_TERMINATOR 255
|
||||
|
||||
class CISODirEntry
|
||||
@ -2637,15 +2637,15 @@ public class CBlkDev
|
||||
I64 locked_flags;
|
||||
U32 bd_signature,
|
||||
type,flags;
|
||||
U8 first_drv_let,unit,pad[2];
|
||||
U8 first_drive_let,unit,pad[2];
|
||||
U32 base0,base1,
|
||||
blk_size;
|
||||
I64 drv_offset,init_root_dir_blks,
|
||||
max_blk;
|
||||
U16 *dev_id_record;
|
||||
U8 *RAM_dsk,
|
||||
*file_dsk_name;
|
||||
CFile *file_dsk;
|
||||
U8 *RAM_disk,
|
||||
*file_disk_name;
|
||||
CFile *file_disk;
|
||||
CTask *owning_task;
|
||||
F64 last_time;
|
||||
U32 max_reads,max_writes;
|
||||
@ -2654,7 +2654,7 @@ public class CBlkDev
|
||||
//Drive locked_flags
|
||||
#define DVlf_LOCKED 0
|
||||
|
||||
//See $LK,"ST_DRV_TYPES",A="MN:ST_DRV_TYPES"$
|
||||
//See $LK,"ST_DRIVE_TYPES",A="MN:ST_DRIVE_TYPES"$
|
||||
#define FSt_NULL 0
|
||||
#define FSt_REDSEA 1 //Supported
|
||||
#define FSt_FAT32 2 //Supported except for short names, to some degree
|
||||
@ -2682,15 +2682,15 @@ class CFreeList
|
||||
I64 start,size;
|
||||
};
|
||||
|
||||
#define DRVS_NUM 26
|
||||
#define DRIVES_NUM 26
|
||||
|
||||
#define DRV_SIGNATURE_VAL 'DVSV'
|
||||
#define DRIVE_SIGNATURE_VAL 'DVSV'
|
||||
public class CDrive
|
||||
{
|
||||
//Don't access ->drv_let directly in case a drive has been remapped.
|
||||
//Use $LK,"Drive2Letter",A="MN:Drive2Letter"$().
|
||||
I64 locked_flags;
|
||||
U32 dv_signature;
|
||||
U32 drive_signature;
|
||||
U8 drv_let,pad;
|
||||
U16 fs_type;
|
||||
I64 drv_offset,
|
||||
@ -2712,13 +2712,13 @@ public class CDrive
|
||||
CFreeList *next_free,*last_free;
|
||||
};
|
||||
|
||||
#define DSK_CACHE_HASH_SIZE 0x2000
|
||||
#define DISK_CACHE_HASH_SIZE 0x2000
|
||||
|
||||
class CCacheBlk
|
||||
{
|
||||
CCacheBlk *next_lru,*last_lru;
|
||||
CCacheBlk *next_hash,*last_hash;
|
||||
CDrive *dv;
|
||||
CDrive *drive;
|
||||
I64 blk;
|
||||
U8 body[BLK_SIZE];
|
||||
};
|
||||
@ -2736,17 +2736,17 @@ public class CBlkDevGlobals
|
||||
U8 *home_dir;
|
||||
CCacheBlk *cache_base,*cache_ctrl,**cache_hash_table;
|
||||
I64 cache_size,read_count,write_count;
|
||||
CDrive *drvs,*let_to_drv[32];
|
||||
CDrive *drvs,*let_to_drive[32];
|
||||
I64 mount_ide_auto_count,
|
||||
ins_base0,ins_base1; //Install cd/dvd controller.
|
||||
U8 boot_drv_let,first_hd_drv_let,first_dvd_drv_let;
|
||||
U8 boot_drive_let,first_hd_drive_let,first_dvd_drive_let;
|
||||
Bool dvd_boot_is_good,ins_unit,pad[3];
|
||||
};
|
||||
|
||||
#help_index "File/Internal"
|
||||
public class CDirContext
|
||||
{
|
||||
CDrive *old_dv,*dv;
|
||||
CDrive *old_dv,*drive;
|
||||
U8 *old_dir,*mask;
|
||||
};
|
||||
|
||||
@ -2764,7 +2764,7 @@ public class CFile //See $LK,"::/Demo/Disk/DataBase.HC"$.
|
||||
{
|
||||
I64 flags;
|
||||
CDirEntry de;
|
||||
CDrive *dv;
|
||||
CDrive *drive;
|
||||
I64 fblk_num,clus,file_clus_num,max_blk;
|
||||
U8 *clus_buf;
|
||||
};
|
||||
@ -3215,8 +3215,8 @@ public class CTaskSettings
|
||||
#help_index "Task"
|
||||
//CTask.border_src
|
||||
#define BDS_CONST 0
|
||||
#define BDS_CUR_DRV 1
|
||||
#define BDS_ED_FILENAME_DRV 2
|
||||
#define BDS_CUR_DRIVE 1
|
||||
#define BDS_ED_FILENAME_DRIVE 2
|
||||
|
||||
//CTask.title_src
|
||||
#define TTS_CONST 0
|
||||
@ -3839,7 +3839,7 @@ public class CDebugGlobals
|
||||
#define BOOT_SRC_NULL 0
|
||||
#define BOOT_SRC_ROM 1
|
||||
#define BOOT_SRC_RAM 2
|
||||
#define BOOT_SRC_HARDDRV 3
|
||||
#define BOOT_SRC_HARDDRIVE 3
|
||||
#define BOOT_SRC_DVD 4
|
||||
|
||||
// $LK,"In",A="MN:In"$("") StdIn for call to $LK,"BootHDIns",A="MN:BootHDIns"$().
|
||||
|
@ -265,8 +265,8 @@ extern U0 SysUntry();
|
||||
public extern U0 throw(I64 ch=0,Bool no_log=FALSE);
|
||||
|
||||
#help_index "File/CD DVD"
|
||||
public extern U0 DVDImageRead(U8 dvd_drv_let,U8 *out_name);
|
||||
public extern U0 DVDImageWrite(U8 dvd_drv_let,
|
||||
public extern U0 DVDImageRead(U8 dvd_drive_let,U8 *out_name);
|
||||
public extern U0 DVDImageWrite(U8 dvd_drive_let,
|
||||
U8 *in_name=NULL,I64 media_type=MT_DVD);
|
||||
|
||||
#help_index "File/CFile"
|
||||
@ -283,11 +283,11 @@ public extern I64 Del(U8 *files_find_mask,Bool make_mask=FALSE,
|
||||
public extern I64 Dir(U8 *files_find_mask="*",Bool full=FALSE);
|
||||
public extern Bool DirMk(U8 *filename,I64 entry_count=0);
|
||||
public extern Bool Drive(U8 drv_let);
|
||||
public extern U0 DiskChg(U8 drv_let=0);
|
||||
public extern U0 DiskChange(U8 drv_let=0);
|
||||
public extern U0 HomeSet(U8 *dirname);
|
||||
|
||||
#help_index "File/Cmd Line (Typically);Cmd Line (Typically);Install"
|
||||
public extern Bool DriveMap(U8 drv_let,CDrive *dv);
|
||||
public extern Bool DriveMap(U8 drv_let,CDrive *drive);
|
||||
|
||||
#help_index "File/FileNames"
|
||||
extern CDirEntry *Cd2DirEntry(CDirEntry *tmpde,U8 *abs_name);
|
||||
@ -295,7 +295,7 @@ public extern U8 *DirCur(CTask *task=NULL,CTask *mem_task=NULL);
|
||||
public extern U8 *DirFile(U8 *dirname,U8 *name=NULL,U8 *_extension=NULL);
|
||||
public extern U8 *DirNameAbs(U8 *dirname);
|
||||
public extern CBlkDev *DriveIsWritable(U8 drv_let=0,Bool except=FALSE);
|
||||
public extern U8 *ExtChg(U8 *filename,U8 *extension);
|
||||
public extern U8 *ExtChange(U8 *filename,U8 *extension);
|
||||
public extern U8 *ExtDefault(U8 *filename,U8 *extension);
|
||||
public extern U8 *FileExtDot(U8 *src);
|
||||
public extern U8 *FileExtRemove(U8 *src,U8 *dst=NULL);
|
||||
@ -319,7 +319,7 @@ public extern U8 *FileNameTmpTxt();
|
||||
public extern U0 DirContextDel(CDirContext *dirc,Bool restore=TRUE);
|
||||
public extern CDirContext *DirContextNew(U8 *mask,
|
||||
Bool make_mask=FALSE,Bool make_dirs=FALSE,Bool no_mask=FALSE);
|
||||
public extern Bool DirNew(CDrive *dv,U8 *cur_dir,
|
||||
public extern Bool DirNew(CDrive *drive,U8 *cur_dir,
|
||||
CDirEntry *tmpde,Bool free_old_chain=TRUE);
|
||||
extern I64 FileAttr(U8 *name,I64 old_attr=0);
|
||||
|
||||
@ -328,40 +328,40 @@ extern I64 FileAttr(U8 *name,I64 old_attr=0);
|
||||
public extern CBlkDev *BlkDevCheck(CBlkDev *bd,Bool except=TRUE);
|
||||
public extern U0 BlkDevDel(CBlkDev *bd);
|
||||
public extern Bool BlkDevLock(CBlkDev *bd);
|
||||
public extern CBlkDev *BlkDevNextFreeSlot(U8 first_drv_let,I64 type);
|
||||
public extern CBlkDev *BlkDevNextFreeSlot(U8 first_drive_let,I64 type);
|
||||
public extern Bool BlkDevUnlock(CBlkDev *bd,Bool reset=FALSE);
|
||||
public extern U0 BlkDevsRelease();
|
||||
public extern Bool BlkRead(CDrive *dv,U8 *buf, I64 blk, I64 count);
|
||||
public extern Bool BlkWrite(CDrive *dv,U8 *buf, I64 blk, I64 count);
|
||||
public extern U0 BlkWriteZero(CDrive *dv,I64 blk,I64 count);
|
||||
public extern I64 Clus2Blk(CDrive *dv,I64 c);
|
||||
public extern I64 ClusAlloc(CDrive *dv,I64 c=0,
|
||||
public extern Bool BlkRead(CDrive *drive,U8 *buf, I64 blk, I64 count);
|
||||
public extern Bool BlkWrite(CDrive *drive,U8 *buf, I64 blk, I64 count);
|
||||
public extern U0 BlkWriteZero(CDrive *drive,I64 blk,I64 count);
|
||||
public extern I64 Clus2Blk(CDrive *drive,I64 c);
|
||||
public extern I64 ClusAlloc(CDrive *drive,I64 c=0,
|
||||
I64 count=1,Bool contiguous=FALSE);
|
||||
public extern I64 ClusBlkRead(CDrive *dv,U8 *buf,I64 c,I64 blks);
|
||||
public extern I64 ClusBlkWrite(CDrive *dv,U8 *buf,I64 c,I64 blks);
|
||||
public extern I64 ClusNumNext(CDrive *dv,I64 c,I64 count=1);
|
||||
public extern I64 ClusRead(CDrive *dv,U8 *buf,I64 c,I64 count);
|
||||
public extern I64 ClusWrite(CDrive *dv,U8 *buf,I64 c,I64 count);
|
||||
public extern I64 ClusBlkRead(CDrive *drive,U8 *buf,I64 c,I64 blks);
|
||||
public extern I64 ClusBlkWrite(CDrive *drive,U8 *buf,I64 c,I64 blks);
|
||||
public extern I64 ClusNumNext(CDrive *drive,I64 c,I64 count=1);
|
||||
public extern I64 ClusRead(CDrive *drive,U8 *buf,I64 c,I64 count);
|
||||
public extern I64 ClusWrite(CDrive *drive,U8 *buf,I64 c,I64 count);
|
||||
extern Bool CopySingle(U8 *f1,U8 *f2); //Just one file
|
||||
public extern U8 Drive2Letter(CDrive *dv=NULL);
|
||||
public extern CDrive *DriveCheck(CDrive *dv,Bool except=TRUE);
|
||||
public extern U0 DriveDel(CDrive *dv);
|
||||
public extern Bool DriveLock(CDrive *dv);
|
||||
public extern U8 Drive2Letter(CDrive *drive=NULL);
|
||||
public extern CDrive *DriveCheck(CDrive *drive,Bool except=TRUE);
|
||||
public extern U0 DriveDel(CDrive *drive);
|
||||
public extern Bool DriveLock(CDrive *drive);
|
||||
public extern CDrive *DriveMakeFreeSlot(U8 drv_let);
|
||||
public extern U8 *DriveModelNum(U8 drv_let=0);
|
||||
public extern U8 DriveNextFreeLet(U8 first_drv_let='C');
|
||||
public extern U8 DriveNextFreeLet(U8 first_drive_let='C');
|
||||
public extern U8 *DriveSerialNum(U8 drv_let=0);
|
||||
public extern U8 DriveTextAttrGet(U8 drv_let=0);
|
||||
public extern Bool DriveUnlock(CDrive *dv,Bool reset=FALSE);
|
||||
public extern Bool DriveUnlock(CDrive *drive,Bool reset=FALSE);
|
||||
public extern U0 DrivesRelease();
|
||||
extern U0 FAT32FreeClus(CDrive *dv,I64 c);
|
||||
extern U0 FAT32FreeClus(CDrive *drive,I64 c);
|
||||
public extern CBlkDev *Letter2BlkDev(U8 drv_let=0,Bool except=TRUE);
|
||||
public extern I64 Letter2BlkDevType(U8 drv_let);
|
||||
public extern CDrive *Letter2Drive(U8 drv_let=0,Bool except=TRUE);
|
||||
public extern U8 Letter2Letter(U8 drv_let=0);
|
||||
extern I64 Name2DirClus(CDrive *dv,U8 *dirname);
|
||||
extern I64 Name2ParentDirClus(CDrive *dv,U8 *dirname);
|
||||
extern U0 RedSeaFreeClus(CDrive *dv,I64 c,I64 count);
|
||||
extern I64 Name2DirClus(CDrive *drive,U8 *dirname);
|
||||
extern I64 Name2ParentDirClus(CDrive *drive,U8 *dirname);
|
||||
extern U0 RedSeaFreeClus(CDrive *drive,I64 c,I64 count);
|
||||
|
||||
#help_index "File/Program Routines"
|
||||
public extern U0 DirEntryDel(CDirEntry *tmpde);
|
||||
@ -377,18 +377,18 @@ public extern I64 FileWrite(U8 *filename,
|
||||
public extern CDirEntry *FilesFind(U8 *files_find_mask,I64 fuf_flags=0);
|
||||
|
||||
#help_index "File/System"
|
||||
public extern CATARep *ATAIDDrives(CATARep *head,CATARep **_ata_drv,
|
||||
CATARep **_atapi_drv);
|
||||
extern CBlkDev *ATAMount(U8 first_drv_let,
|
||||
public extern CATARep *ATAIDDrives(CATARep *head,CATARep **_ata_drive,
|
||||
CATARep **_atapi_drive);
|
||||
extern CBlkDev *ATAMount(U8 first_drive_let,
|
||||
I64 type,I64 base0,I64 base1,I64 unit);
|
||||
extern Bool ATAPIStartStop(CBlkDev *bd,F64 timeout,Bool start);
|
||||
extern I64 ATAProbe(I64 base0,I64 base1,I64 unit);
|
||||
extern U0 ATAReadBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 count);
|
||||
extern U0 ATAWriteBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 count);
|
||||
extern I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
|
||||
Bool whole_drv,Bool make_free);
|
||||
Bool whole_drive,Bool make_free);
|
||||
extern U0 DiskCacheInit(I64 size_in_U8s);
|
||||
public extern U0 DiskCacheInvalidate(CDrive *dv);
|
||||
public extern U0 DiskCacheInvalidate(CDrive *drive);
|
||||
public extern I64 MountIDEAuto();
|
||||
public extern CBlkDevGlobals blkdev;
|
||||
|
||||
|
@ -17,30 +17,30 @@ U0 InstallDrive(U8 drv_let)
|
||||
Free(st);
|
||||
}
|
||||
|
||||
Bool VMPrtDsk(CTask *task,CATARep *ata_drv)
|
||||
Bool VMPartDisk(CTask *task,CATARep *ata_drive)
|
||||
{
|
||||
if (ata_drv) {
|
||||
XTalkWait(task,"DiskPrt(,0.5,0.5);\nC\np%d\nY",ata_drv->num);
|
||||
if (ata_drive) {
|
||||
XTalkWait(task,"DiskPart(,0.5,0.5);\nC\np%d\nY",ata_drive->num);
|
||||
return TRUE;
|
||||
} else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
U0 VMInstallDrive(CTask *task,U8 drv_let,
|
||||
CATARep *ata_drv,CATARep *atapi_drv)
|
||||
CATARep *ata_drive,CATARep *atapi_drive)
|
||||
{
|
||||
InstallDrive(drv_let);
|
||||
XTalkWait(task,"BootHDIns('%C');\n\nB\n0x20000\n",drv_let);
|
||||
if (ata_drv)
|
||||
XTalkWait(task,"C\np%d\n",ata_drv->num);
|
||||
if (atapi_drv)
|
||||
XTalkWait(task,"Tp%d\n",atapi_drv->num);
|
||||
if (ata_drive)
|
||||
XTalkWait(task,"C\np%d\n",ata_drive->num);
|
||||
if (atapi_drive)
|
||||
XTalkWait(task,"Tp%d\n",atapi_drive->num);
|
||||
XTalkWait(task,"\n\n\n"); //Exit Drives,Disk Cache,Options
|
||||
}
|
||||
|
||||
U0 VMInstallWiz()
|
||||
{
|
||||
CATARep *head=NULL,*ata_drv=NULL,*atapi_drv=NULL;
|
||||
CATARep *head=NULL,*ata_drive=NULL,*atapi_drive=NULL;
|
||||
CTask *task;
|
||||
"\nIt's normal for this to freeze for a moment or two.\n";
|
||||
PressAKey;
|
||||
@ -57,10 +57,10 @@ U0 VMInstallWiz()
|
||||
WinToTop(Fs);
|
||||
|
||||
ATARep(FALSE,TRUE,&head);
|
||||
ATAIDDrives(head,&ata_drv,&atapi_drv);
|
||||
if (VMPrtDsk(task,ata_drv)) {
|
||||
VMInstallDrive(task,'C',ata_drv,atapi_drv);
|
||||
VMInstallDrive(task,'D',ata_drv,atapi_drv);
|
||||
ATAIDDrives(head,&ata_drive,&atapi_drive);
|
||||
if (VMPartDisk(task,ata_drive)) {
|
||||
VMInstallDrive(task,'C',ata_drive,atapi_drive);
|
||||
VMInstallDrive(task,'D',ata_drive,atapi_drive);
|
||||
BootMHDIns('C');
|
||||
}
|
||||
LinkedListDel(head);
|
||||
|
@ -74,7 +74,7 @@ U0 DoDataBase()
|
||||
{
|
||||
XTalkWait(task,"#include \"::/Demo/Disk/DataBase\";\n");
|
||||
}
|
||||
U0 DoDskRaw()
|
||||
U0 DoDiskRaw()
|
||||
{
|
||||
XTalkWait(task,"#include \"::/Demo/Disk/DiskRaw\";\n");
|
||||
}
|
||||
|
@ -4014,7 +4014,7 @@
|
||||
0006 emu10k1x Soundblaster Live! 5.1 (SB0200)
|
||||
0007 C6SB0410515017656A Sound Blaster 5.1 vhttp://files2.europe.creative.com/manualdn/Drivers/AVP/10599/0x48689B99/SB51_XPDR
|
||||
0008 ca0108 sound blaster Audigy 4
|
||||
000A SB24PCDRVLB1040090 Creative Labs Sound Blaster X-Fi Xtreme Audio
|
||||
000A SB24PCDRIVELB1040090 Creative Labs Sound Blaster X-Fi Xtreme Audio
|
||||
000B SB1270 Sound Blaster X-Fi Titanium HD
|
||||
000D SB0880 PCIe SB X-Fi Titanium Fatal1ty Pro Series
|
||||
0011 SB1500 Sound Blaster Z
|
||||
@ -6721,7 +6721,7 @@
|
||||
16A6 BCM5702X Gigabit Ethernet
|
||||
16A7 BCM5703X Gigabit Ethernet
|
||||
16A8 BLM5701 NetXtreme Gigabit Ethernet
|
||||
16AA B06BDRV BroadCom NetExtreme II Server
|
||||
16AA B06BDRIVE BroadCom NetExtreme II Server
|
||||
16B1 BCM57781 BCM57781
|
||||
16B5 BCM57785X Broadcom NetLink Gigabit Ethernet
|
||||
16BE 16BE8 CardReader Broadcom 1.0.0.221
|
||||
|
@ -36,7 +36,7 @@ U0 Tmp()
|
||||
}
|
||||
break;
|
||||
case BOOT_SRC_RAM:
|
||||
case BOOT_SRC_HARDDRV:
|
||||
case BOOT_SRC_HARDDRIVE:
|
||||
"$$PURPLE$$$$TX+CX,\"Tip of the Day\"$$$$FG$$\n";
|
||||
TipOfDay;
|
||||
// Type("::/Doc/Customize.DD");
|
||||
@ -47,7 +47,7 @@ U0 Tmp()
|
||||
// Cd("::/Misc/Tour");
|
||||
// InFile("Tour");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
@ -40,7 +40,7 @@ BDVD_GET_RIP:
|
||||
DU8 0xEA; //JMP BOOT_HIGH_LOC_DVD:BDVD_MAIN
|
||||
DU16 BDVD_MAIN-BDVD_START,BOOT_HIGH_LOC_DVD;
|
||||
|
||||
BDVD_BIOS_DRV_NUM: DU8 0;
|
||||
BDVD_BIOS_DRIVE_NUM: DU8 0;
|
||||
BDVD_PAGE: DU8 0;
|
||||
|
||||
BDVD_DAP: DU8 16,0,1,0; //One blk at a time
|
||||
@ -76,7 +76,7 @@ BDVD_PUTS::
|
||||
JMP @@1
|
||||
|
||||
BDVD_MAIN::
|
||||
MOV U8 [BDVD_BIOS_DRV_NUM-BDVD_START],DL //Passed in by BIOS
|
||||
MOV U8 [BDVD_BIOS_DRIVE_NUM-BDVD_START],DL //Passed in by BIOS
|
||||
|
||||
MOV AH,0xF
|
||||
INT 0x10
|
||||
@ -124,7 +124,7 @@ BDVD_MAIN::
|
||||
MOV U16 [BDVD_DAP_BUF+2-BDVD_START],AX //ES:0000
|
||||
MOV SI,BDVD_DAP-BDVD_START //DS:SI=DAP
|
||||
MOV AH,0x42
|
||||
MOV DL,U8 [BDVD_BIOS_DRV_NUM-BDVD_START]
|
||||
MOV DL,U8 [BDVD_BIOS_DRIVE_NUM-BDVD_START]
|
||||
INT 0x13
|
||||
|
||||
POP AX //ES
|
||||
|
@ -42,7 +42,7 @@ BHD_GET_RIP:
|
||||
DU8 0xEA; //JMP BOOT_HIGH_LOC_HD:BHD_HISTART
|
||||
DU16 BHD_HISTART-BHD_START,BOOT_HIGH_LOC_HD;
|
||||
|
||||
BHD_BIOS_DRV_NUM: DU8 0;
|
||||
BHD_BIOS_DRIVE_NUM: DU8 0;
|
||||
|
||||
//Gets patched by $LK,"BootHDIns",A="MN:BootHDIns"$().
|
||||
BHD_BLK_COUNT:: DU16 0;
|
||||
@ -55,7 +55,7 @@ BHD_DAP_BLK_LO: DU32 0;
|
||||
BHD_DAP_BLK_HI: DU32 0;
|
||||
|
||||
BHD_HISTART:
|
||||
MOV U8 [BHD_BIOS_DRV_NUM-BHD_START],DL //Passed in by BIOS
|
||||
MOV U8 [BHD_BIOS_DRIVE_NUM-BHD_START],DL //Passed in by BIOS
|
||||
MOV AX,BOOT_RAM_BASE/16
|
||||
MOV ES,AX
|
||||
XOR ECX,ECX
|
||||
@ -69,7 +69,7 @@ BHD_HISTART:
|
||||
MOV U16 [BHD_DAP_BUF+2-BHD_START],AX //ES:0000
|
||||
MOV SI,BHD_DAP-BHD_START //DS:SI=DAP
|
||||
MOV AH,0x42
|
||||
MOV DL,U8 [BHD_BIOS_DRV_NUM-BHD_START]
|
||||
MOV DL,U8 [BHD_BIOS_DRIVE_NUM-BHD_START]
|
||||
INT 0x13
|
||||
|
||||
POP AX //ES
|
||||
@ -83,7 +83,7 @@ BHD_HISTART:
|
||||
LOOP @@05
|
||||
|
||||
XOR EBX,EBX
|
||||
MOV EAX,BOOT_SRC_HARDDRV //$MA-X+PU,"See sys_boot_src",LM="Find(\"sys_boot_src\",\"/*\");View;\n"$
|
||||
MOV EAX,BOOT_SRC_HARDDRIVE //$MA-X+PU,"See sys_boot_src",LM="Find(\"sys_boot_src\",\"/*\");View;\n"$
|
||||
//My assembler doesn't support 16-bit very well.
|
||||
DU8 0xEA; //JMP BOOT_RAM_BASE:0000
|
||||
DU16 0,BOOT_RAM_BASE/16;
|
||||
|
@ -23,16 +23,16 @@ U0 MakeAll()
|
||||
|
||||
public U0 BootHDIns(U8 drv_let=0)
|
||||
{//$LK,"MakeAll",A="MN:MakeAll"$ and install new boot-loader.
|
||||
CDrive *dv;
|
||||
CDrive *drive;
|
||||
CFAT32Boot br;
|
||||
CDirEntry de;
|
||||
I64 i;
|
||||
try {
|
||||
if (!Drive(drv_let))
|
||||
throw;
|
||||
dv=Fs->cur_dv;
|
||||
drive=Fs->cur_dv;
|
||||
MakeAll;
|
||||
switch (Letter2BlkDevType(dv->drv_let)) {
|
||||
switch (Letter2BlkDevType(drive->drv_let)) {
|
||||
case BDT_RAM:
|
||||
case BDT_ATA:
|
||||
Move("/Kernel/Kernel.BIN","/" KERNEL_BIN_C);
|
||||
@ -41,19 +41,19 @@ public U0 BootHDIns(U8 drv_let=0)
|
||||
else {
|
||||
Free(de.full_name);
|
||||
"Modifying partition boot record.\n";
|
||||
BlkRead(dv,&br,dv->drv_offset,1);
|
||||
BlkRead(drive,&br,drive->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_COUNT(U16 *)=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
*BHD_DAP_BLK(I64 *)=Clus2Blk(dv,de.clus);
|
||||
*BHD_DAP_BLK(I64 *)=Clus2Blk(drive,de.clus);
|
||||
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;
|
||||
BlkWrite(dv,&br,dv->drv_offset,1);
|
||||
BlkWrite(drive,&br,drive->drv_offset,1);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -56,7 +56,7 @@ BMHD_GET_RIP:
|
||||
DU8 0xEA; //JMP BOOT_HIGH_LOC_MHD:BMHD_HISTART
|
||||
DU16 BMHD_HISTART-BMHD_START,BOOT_HIGH_LOC_MHD;
|
||||
|
||||
BMHD_BIOS_DRV_NUM: DU8 0;
|
||||
BMHD_BIOS_DRIVE_NUM: DU8 0;
|
||||
BMHD_OLD_CS_RIP: DU16 0,0;
|
||||
//Gets patched by $LK,"BootHDIns",A="MN:BootHDIns"$().
|
||||
BMHD_BLK_COUNT:: DU16 0;
|
||||
@ -69,7 +69,7 @@ BMHD_DAP_BLK_LO: DU32 0;
|
||||
BMHD_DAP_BLK_HI: DU32 0;
|
||||
|
||||
BMHD_HISTART:
|
||||
MOV U8 [BMHD_BIOS_DRV_NUM-BMHD_START],DL //Passed in by BIOS
|
||||
MOV U8 [BMHD_BIOS_DRIVE_NUM-BMHD_START],DL //Passed in by BIOS
|
||||
MOV AX,BOOT_RAM_BASE/16
|
||||
MOV ES,AX
|
||||
XOR ECX,ECX
|
||||
@ -83,7 +83,7 @@ BMHD_HISTART:
|
||||
MOV U16 [BMHD_DAP_BUF+2-BMHD_START],AX //ES:0000
|
||||
MOV SI,BMHD_DAP-BMHD_START //DS:SI=DAP
|
||||
MOV AH,0x42
|
||||
MOV DL,U8 [BMHD_BIOS_DRV_NUM-BMHD_START]
|
||||
MOV DL,U8 [BMHD_BIOS_DRIVE_NUM-BMHD_START]
|
||||
INT 0x13
|
||||
|
||||
POP AX //ES
|
||||
@ -96,7 +96,7 @@ BMHD_HISTART:
|
||||
@@10: POP CX
|
||||
LOOP @@05
|
||||
|
||||
MOV DL,U8 [BMHD_BIOS_DRV_NUM-BMHD_START]
|
||||
MOV DL,U8 [BMHD_BIOS_DRIVE_NUM-BMHD_START]
|
||||
MOV EBX,U32 [BMHD_OLD_CS_RIP-BMHD_START]
|
||||
//My assembler doesn't support 16-bit very well.
|
||||
DU8 0xEA; //JMP BOOT_RAM_BASE:0000
|
||||
|
@ -16,7 +16,7 @@ BMHD2_START::
|
||||
MOV AX,CS
|
||||
MOV DS,AX
|
||||
MOV U32 [BMHD2_OLD_CS_RIP-BMHD2_START],EBX
|
||||
MOV U8 [BMHD2_BIOS_DRV_NUM-BMHD2_START],DL
|
||||
MOV U8 [BMHD2_BIOS_DRIVE_NUM-BMHD2_START],DL
|
||||
|
||||
MOV CX,MODULE_SIZE
|
||||
XOR SI,SI
|
||||
@ -33,7 +33,7 @@ BMHD2_START::
|
||||
BMHD2_BOOT_MESSAGE::
|
||||
DU8 256 DUP(0);
|
||||
|
||||
BMHD2_BIOS_DRV_NUM: DU8 0;
|
||||
BMHD2_BIOS_DRIVE_NUM: DU8 0;
|
||||
BMHD2_PAGE: DU8 0;
|
||||
BMHD2_BLK_ARRAY:: DU64 8 DUP(0);
|
||||
|
||||
@ -98,7 +98,7 @@ BMHD2_HISTART:
|
||||
ADD AX,U16 [BMHD2_OLD_CS_RIP+2-BMHD2_START]
|
||||
MOV U16 [BMHD2_DAP_BUF+2-BMHD2_START],AX //ES:0000
|
||||
MOV SI,BMHD2_DAP-BMHD2_START //DS:SI=DAP
|
||||
MOV DL,U8 [BMHD2_BIOS_DRV_NUM-BMHD2_START]
|
||||
MOV DL,U8 [BMHD2_BIOS_DRIVE_NUM-BMHD2_START]
|
||||
MOV AH,0x42
|
||||
INT 0x13
|
||||
|
||||
|
@ -12,15 +12,15 @@
|
||||
//Old master boot record
|
||||
#define BOOT_DIR_OLDMBR_BIN_C BOOT_DIR "/OldMBR.BIN.C"
|
||||
|
||||
public U0 BootMHDOldRead(U8 src_drv,U8 dst_drv)
|
||||
public U0 BootMHDOldRead(U8 src_drive,U8 dst_drive)
|
||||
{//Reads MBR from disk drive containing src partition.
|
||||
//Writes a single blk file to dst BOOT_DIR.
|
||||
CBlkDev *bd=Letter2BlkDev(src_drv);
|
||||
CDrive *dv;
|
||||
CBlkDev *bd=Letter2BlkDev(src_drive);
|
||||
CDrive *drive;
|
||||
CMasterBoot mbr;
|
||||
Drive(dst_drv);
|
||||
dv=Fs->cur_dv;
|
||||
if (dv->fs_type!=FSt_REDSEA && dv->fs_type!=FSt_FAT32)
|
||||
Drive(dst_drive);
|
||||
drive=Fs->cur_dv;
|
||||
if (drive->fs_type!=FSt_REDSEA && drive->fs_type!=FSt_FAT32)
|
||||
PrintErr("File System Not Supported\n");
|
||||
else {
|
||||
//Bypass partition bounds-checking
|
||||
@ -28,18 +28,18 @@ public U0 BootMHDOldRead(U8 src_drv,U8 dst_drv)
|
||||
ATAReadBlks(bd,&mbr,0,1);
|
||||
BlkDevUnlock(bd);
|
||||
|
||||
Drive(dst_drv);
|
||||
Drive(dst_drive);
|
||||
DirMk(BOOT_DIR);
|
||||
FileWrite(BOOT_DIR_OLDMBR_BIN_C,&mbr,BLK_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
public U0 BootMHDOldWrite(U8 src_drv,U8 dst_drv)
|
||||
public U0 BootMHDOldWrite(U8 src_drive,U8 dst_drive)
|
||||
{//Reads OldMBR from src drive BOOT_DIR.
|
||||
//writes it to the MBR of the drive with dst partition.
|
||||
CBlkDev *bd=Letter2BlkDev(dst_drv);
|
||||
CBlkDev *bd=Letter2BlkDev(dst_drive);
|
||||
CMasterBoot *mbr;
|
||||
Drive(src_drv);
|
||||
Drive(src_drive);
|
||||
if (mbr=FileRead(BOOT_DIR_OLDMBR_BIN_C)) {
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bd);
|
||||
@ -49,7 +49,7 @@ public U0 BootMHDOldWrite(U8 src_drv,U8 dst_drv)
|
||||
Free(mbr);
|
||||
}
|
||||
|
||||
public U0 BootMHDZero(U8 dst_drv)
|
||||
public U0 BootMHDZero(U8 dst_drive)
|
||||
{//Set MBR of disk with dst partition to zero.
|
||||
|
||||
//This is dangerous!!
|
||||
@ -57,7 +57,7 @@ public U0 BootMHDZero(U8 dst_drv)
|
||||
//with other operating systems at this time and you need
|
||||
//to do this on a drive partitioned by ZenithOS
|
||||
//if you wish to partition with another operating system.
|
||||
CBlkDev *bd=Letter2BlkDev(dst_drv);
|
||||
CBlkDev *bd=Letter2BlkDev(dst_drive);
|
||||
CMasterBoot mbr;
|
||||
MemSet(&mbr,0,BLK_SIZE);
|
||||
//Bypass partition bounds-checking
|
||||
@ -70,7 +70,7 @@ public Bool BootMHDIns(U8 drv_let,U8 *drv_list=NULL)
|
||||
{//Create new MBR on the disk that has drv_let as a partition.
|
||||
//Puts stage 2 in BOOT_DIR of drv_let.
|
||||
CBlkDev *bd,*bd1;
|
||||
CDrive *dv,*p1;
|
||||
CDrive *drive,*p1;
|
||||
CMasterBoot mbr;
|
||||
CDirEntry de;
|
||||
I64 i,j,size,*_q;
|
||||
@ -88,11 +88,11 @@ public Bool BootMHDIns(U8 drv_let,U8 *drv_list=NULL)
|
||||
buf[j++]=0;
|
||||
}
|
||||
Drive(drv_let);
|
||||
dv=Fs->cur_dv;
|
||||
if (dv->fs_type!=FSt_REDSEA && dv->fs_type!=FSt_FAT32)
|
||||
drive=Fs->cur_dv;
|
||||
if (drive->fs_type!=FSt_REDSEA && drive->fs_type!=FSt_FAT32)
|
||||
PrintErr("File System Not Supported\n");
|
||||
else {
|
||||
bd=dv->bd;
|
||||
bd=drive->bd;
|
||||
if (!FileFind(BOOT_DIR_OLDMBR_BIN_C,,FUF_JUST_FILES))
|
||||
BootMHDOldRead(drv_let,drv_let);
|
||||
|
||||
@ -103,7 +103,7 @@ public Bool BootMHDIns(U8 drv_let,U8 *drv_list=NULL)
|
||||
j=0;
|
||||
if (FileFind(BOOT_DIR_OLDMBR_BIN_C,&de,FUF_JUST_FILES)) {
|
||||
Free(de.full_name);
|
||||
*_q++=Clus2Blk(dv,de.clus);
|
||||
*_q++=Clus2Blk(drive,de.clus);
|
||||
CatPrint(menu_ptr,"0. Old Boot Record\n\r");
|
||||
j++;
|
||||
}
|
||||
@ -127,7 +127,7 @@ public Bool BootMHDIns(U8 drv_let,U8 *drv_list=NULL)
|
||||
else {
|
||||
Free(de.full_name);
|
||||
*BMHD_BLK_COUNT(U16 *)=(size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
*BMHD_DAP_BLK(I64 *)=Clus2Blk(dv,de.clus);
|
||||
*BMHD_DAP_BLK(I64 *)=Clus2Blk(drive,de.clus);
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bd);
|
||||
ATAReadBlks(bd,&mbr,0,1);
|
||||
|
@ -47,7 +47,7 @@ U0 RedSeaISO9660Stage1(U8 *iso_filename,U8 *stage2_filename)
|
||||
|
||||
U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let)
|
||||
{
|
||||
CDrive *dv=Letter2Drive(drv_let);
|
||||
CDrive *drive=Letter2Drive(drv_let);
|
||||
CISOPriDesc *iso_pri=CAlloc(DVD_BLK_SIZE),
|
||||
*iso_boot=CAlloc(DVD_BLK_SIZE),
|
||||
*iso_sup=CAlloc(DVD_BLK_SIZE),
|
||||
@ -60,7 +60,7 @@ U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let)
|
||||
|
||||
if (out_file=FOpen(iso_filename,"wc+")) {
|
||||
iso_size=FSize(out_file)/DVD_BLK_SIZE;
|
||||
for (i=0;i<dv->bd->drv_offset;i+=4)
|
||||
for (i=0;i<drive->bd->drv_offset;i+=4)
|
||||
FBlkWrite(out_file,zero_buf,i,4);
|
||||
|
||||
iso_pri->type=ISOT_PRI_VOL_DESC;
|
||||
@ -70,7 +70,7 @@ U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let)
|
||||
FillU16Palindrome(&iso_pri->vol_seq_num,1);
|
||||
FillU16Palindrome(&iso_pri->log_block_size,DVD_BLK_SIZE);
|
||||
FillU32Palindrome(&iso_pri->vol_space_size,iso_size);
|
||||
FillU32Palindrome(&iso_pri->root_dir_record,dv->root_clus);
|
||||
FillU32Palindrome(&iso_pri->root_dir_record,drive->root_clus);
|
||||
iso_pri->file_structure_version=1;
|
||||
StrCpy(iso_pri->publisher_id,"ZenithOS RedSea");
|
||||
|
||||
@ -139,19 +139,19 @@ public I64 RedSeaISO(U8 *_iso_filename=NULL,U8 *_src_dir,
|
||||
I64 i,res,root_count,root_dir_blks,bitmap_blks,bitmap_blks1;
|
||||
CDirEntry *tmpde;
|
||||
U8 buf[STR_LEN],*iso_filename,*src_dir,*stage2_filename;
|
||||
CDrive *dv=DriveMakeFreeSlot(DriveNextFreeLet('Q')); //First $LK,"BDT_ISO_FILE_WRITE",A="MN:BDT_ISO_FILE_WRITE"$
|
||||
CBlkDev *bd=BlkDevNextFreeSlot(dv->drv_let,BDT_ISO_FILE_WRITE);
|
||||
CDrive *drive=DriveMakeFreeSlot(DriveNextFreeLet('Q')); //First $LK,"BDT_ISO_FILE_WRITE",A="MN:BDT_ISO_FILE_WRITE"$
|
||||
CBlkDev *bd=BlkDevNextFreeSlot(drive->drv_let,BDT_ISO_FILE_WRITE);
|
||||
|
||||
if (!IsDir(_src_dir))
|
||||
PrintErr("'%s' is not a dir.\n",_src_dir);
|
||||
else {
|
||||
if (!_iso_filename)
|
||||
_iso_filename=blkdev.default_iso_c_filename;
|
||||
iso_filename=ExtChg(_iso_filename,"ISO.C");
|
||||
iso_filename=ExtChange(_iso_filename,"ISO.C");
|
||||
src_dir=DirNameAbs(_src_dir);
|
||||
if (_stage2_filename) {
|
||||
stage2_filename=FileNameAbs(_stage2_filename);
|
||||
*stage2_filename=dv->drv_let;
|
||||
*stage2_filename=drive->drv_let;
|
||||
i=StrLen(src_dir);
|
||||
if (i!=3) //If not root
|
||||
i++; //Skip slash
|
||||
@ -171,13 +171,13 @@ public I64 RedSeaISO(U8 *_iso_filename=NULL,U8 *_src_dir,
|
||||
|
||||
bd->max_blk=CeilI64(bd->drv_offset+1+bitmap_blks+res,4);
|
||||
bd->max_blk--; //Inclusive.
|
||||
bd->file_dsk_name=AStrNew(iso_filename);
|
||||
bd->file_disk_name=AStrNew(iso_filename);
|
||||
bd->init_root_dir_blks=root_dir_blks;
|
||||
BlkDevAdd(bd,,TRUE,TRUE);
|
||||
StrPrint(buf,"%C:/",dv->drv_let);
|
||||
StrPrint(buf,"%C:/",drive->drv_let);
|
||||
CopyTree(src_dir,buf,TRUE);
|
||||
RedSeaISO9660Stage1(iso_filename,stage2_filename);
|
||||
DriveDel(dv);
|
||||
DriveDel(drive);
|
||||
BlkDevDel(bd);
|
||||
}
|
||||
Free(stage2_filename);
|
||||
|
@ -50,7 +50,7 @@ U0 DocInit()
|
||||
if (Bt(&doldoc.default_de_flags[i],DOCEf_TAG) && i!=DOCT_TEXT || i==DOCT_HEX_ED)
|
||||
Bts(doldoc.type_flags_form,i);
|
||||
|
||||
//Don't forget $LK,"cmp_type_flags_src_code",A="MN:cmp_type_flags_src_code"$.
|
||||
//Don't forget $LK,"comp_type_flags_src_code",A="MN:comp_type_flags_src_code"$.
|
||||
doldoc.type_flags_nontag_invis[0]=
|
||||
1<<DOCT_PROMPT|
|
||||
1<<DOCT_PAGE_LEN|
|
||||
|
@ -111,7 +111,7 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
||||
doc=DocRead(filename,flags);
|
||||
doc->desc='Edit';
|
||||
Silent(old_silent);
|
||||
Fs->border_src=BDS_ED_FILENAME_DRV;
|
||||
Fs->border_src=BDS_ED_FILENAME_DRIVE;
|
||||
}
|
||||
Free(st1);
|
||||
Free(st2);
|
||||
|
@ -194,12 +194,12 @@ U0 DocUpdateTaskDocs(CTask *task)
|
||||
{//This is called from $LK,"GrUpdateTaskWin",A="MN:GrUpdateTaskWin"$() by the winmgr at 30fps.
|
||||
CDoc *doc;
|
||||
CD3I64 saved_scroll;
|
||||
if (task->border_src==BDS_CUR_DRV && task->cur_dv)
|
||||
if (task->border_src==BDS_CUR_DRIVE && task->cur_dv)
|
||||
task->border_attr=DriveTextAttrGet(Drive2Letter(task->cur_dv));
|
||||
if (task->title_src==TTS_TASK_NAME)
|
||||
StrCpy(task->task_title,task->task_name);
|
||||
if ((doc=DocDisplay(task)) && !(doc->flags&DOCF_DONT_SHOW)) {
|
||||
if (task->border_src==BDS_ED_FILENAME_DRV)
|
||||
if (task->border_src==BDS_ED_FILENAME_DRIVE)
|
||||
task->border_attr=DriveTextAttrGet(*doc->filename.name);
|
||||
if (task->title_src==TTS_ED_FILENAME)
|
||||
MemCpy(task->task_title,doc->filename.name,STR_LEN-1);
|
||||
|
@ -41,7 +41,7 @@ public U0 DocTermNew()
|
||||
CDoc *pdoc=DocNew;
|
||||
pdoc->right_click_link=&TermRightClickLink;
|
||||
pdoc->max_entries=4096;
|
||||
Fs->border_src=BDS_CUR_DRV;
|
||||
Fs->border_src=BDS_CUR_DRIVE;
|
||||
pdoc->desc='Term';
|
||||
Fs->put_doc=Fs->display_doc=pdoc;
|
||||
Fs->border_doc=DocBorderNew(pdoc);
|
||||
|
@ -34,7 +34,7 @@ MemSet(&doldoc,0,sizeof(CDolDocGlobals));
|
||||
#help_index "God"
|
||||
#define BIBLE_FILENAME "::/Misc/Bible.TXT"
|
||||
|
||||
#include "DocExt"
|
||||
#include "DocExterns"
|
||||
#include "DocBin"
|
||||
#include "DocNew"
|
||||
#include "DocForm"
|
||||
|
@ -268,7 +268,7 @@ public U0 DCMono(CDC *dc,
|
||||
*dst++=false_color;
|
||||
}
|
||||
|
||||
public I64 DCColorChg(CDC *dc,I64 src_color,I64 dst_color=TRANSPARENT)
|
||||
public I64 DCColorChange(CDC *dc,I64 src_color,I64 dst_color=TRANSPARENT)
|
||||
{//Find and replace src color with dst in device context.
|
||||
I64 i,res=0;
|
||||
U8 *dst;
|
||||
|
@ -2,7 +2,7 @@ Cd(__DIR__);;
|
||||
|
||||
#include "GrInitA"
|
||||
#include "Gr.HH"
|
||||
#include "GrExt"
|
||||
#include "GrExterns"
|
||||
#include "GrGlobals"
|
||||
#include "GrTextBase"
|
||||
#include "GrAsm"
|
||||
|
@ -268,7 +268,7 @@ bm_menu:
|
||||
if (i>=0) {
|
||||
j=PopUpColor("Replace Color\n",,FALSE);
|
||||
if (j>=0) {
|
||||
DCColorChg(img,i,j);
|
||||
DCColorChange(img,i,j);
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
}
|
||||
}
|
||||
@ -391,7 +391,7 @@ bm_menu:
|
||||
clip->flags&=~DCF_NO_TRANSPARENTS;
|
||||
} else {
|
||||
dc2=DCCopy(clip);
|
||||
DCColorChg(dc2,bkcolor);
|
||||
DCColorChange(dc2,bkcolor);
|
||||
GrBlot(dc,arg1,arg2,dc2);
|
||||
DCDel(dc2);
|
||||
}
|
||||
@ -518,7 +518,7 @@ bm_menu:
|
||||
clip->flags&=~DCF_NO_TRANSPARENTS;
|
||||
} else {
|
||||
dc2=DCCopy(clip);
|
||||
DCColorChg(dc2,bkcolor);
|
||||
DCColorChange(dc2,bkcolor);
|
||||
GrBlot(dc,arg1,arg2,dc2);
|
||||
DCDel(dc2);
|
||||
}
|
||||
@ -630,7 +630,7 @@ bm_menu:
|
||||
clip->flags&=~DCF_NO_TRANSPARENTS;
|
||||
} else {
|
||||
dc2=DCCopy(clip);
|
||||
DCColorChg(dc2,bkcolor);
|
||||
DCColorChange(dc2,bkcolor);
|
||||
GrBlot(img,arg1-xx1,arg2-yy1,dc2);
|
||||
DCDel(dc2);
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ CSprite *SMScreenBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,
|
||||
img=DCExt(dc3,Fs->pix_left+Fs->scroll_x+xx1,Fs->pix_top+Fs->scroll_y+yy1,
|
||||
Fs->pix_left+Fs->scroll_x+xx2-1,Fs->pix_top+Fs->scroll_y+yy2-1);
|
||||
if (eletype==SPT_INS_TRANSPARENT_SCRN_BITMAP)
|
||||
DCColorChg(img,bm_bkcolor);
|
||||
DCColorChange(img,bm_bkcolor);
|
||||
GrScaleZoom(i);
|
||||
MemCpy(&res->pwhu.u,img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
DCDel(img);
|
||||
|
@ -12,7 +12,7 @@ Cd(__DIR__);;
|
||||
#include "Win"
|
||||
#include "WinMgr"
|
||||
#include "ZDebug"
|
||||
#include "::/Zenith/God/GodExt"
|
||||
#include "::/Zenith/God/GodExterns"
|
||||
#include "DolDoc/MakeDoc"
|
||||
LBts(&sys_run_level,RLf_DOC);
|
||||
#include "Ctrls/MakeCtrls"
|
||||
|
@ -56,14 +56,14 @@ I64 SizeRep1(CDirEntry *tmpde,I64 *_fuf_flags)
|
||||
{
|
||||
I64 res=0,i;
|
||||
U8 buf[BLK_SIZE];
|
||||
CDrive *dv;
|
||||
CDrive *drive;
|
||||
while (tmpde) {
|
||||
if (tmpde->attr&RS_ATTR_DIR)
|
||||
i=SizeRep1(tmpde->sub,_fuf_flags);
|
||||
else if ((i=tmpde->size) && Bt(_fuf_flags,FUf_EXPAND) &&
|
||||
FileAttr(tmpde->name)&RS_ATTR_COMPRESSED) {
|
||||
dv=Letter2Drive(*tmpde->full_name);
|
||||
BlkRead(dv,buf,Clus2Blk(dv,tmpde->clus),1);
|
||||
drive=Letter2Drive(*tmpde->full_name);
|
||||
BlkRead(drive,buf,Clus2Blk(drive,tmpde->clus),1);
|
||||
i=(&buf)(CArcCompress *)->expanded_size;
|
||||
}
|
||||
tmpde->user_data=i;
|
||||
|
@ -70,8 +70,8 @@ I64 BlkDevsSize()
|
||||
if (bd->bd_signature==BD_SIGNATURE_VAL) {
|
||||
j=(bd->max_blk+1)<<BLK_SIZE_BITS;
|
||||
if (bd->type==BDT_RAM)
|
||||
"RAMDsk%C\t:%010X/%010X\n",
|
||||
bd->first_drv_let,j-DriveUnused(bd->first_drv_let),j;
|
||||
"RAMDisk%C\t:%010X/%010X\n",
|
||||
bd->first_drive_let,j-DriveUnused(bd->first_drive_let),j;
|
||||
res+=MSize2(bd->dev_id_record);
|
||||
}
|
||||
}
|
||||
@ -81,7 +81,7 @@ I64 BlkDevsSize()
|
||||
I64 DrivesSize()
|
||||
{
|
||||
I64 i,res=MSize2(blkdev.drvs);
|
||||
for (i=0;i<DRVS_NUM;i++)
|
||||
for (i=0;i<DRIVES_NUM;i++)
|
||||
res+=MSize2(blkdev.drvs[i].cur_fat_blk)+MSize2(blkdev.drvs[i].fis);
|
||||
return res;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public U0 ToTXT(U8 *_in_name,U8 *_out_name=NULL,I64 width=70)
|
||||
if (_out_name)
|
||||
out_name=ExtDefault(_out_name,"TXT");
|
||||
else
|
||||
out_name=ExtChg(_in_name,"TXT");
|
||||
out_name=ExtChange(_in_name,"TXT");
|
||||
|
||||
doc_in=DocRead(in_name);
|
||||
doc_out=Doc2TXT(doc_in);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#help_index "Info;File/Cmd Line (Typically);Cmd Line (Typically)"
|
||||
Bool CheckDskConfirm(Bool *_fix,Bool *_confirm)
|
||||
Bool CheckDiskConfirm(Bool *_fix,Bool *_confirm)
|
||||
{
|
||||
if (*_fix && *_confirm) {
|
||||
"Fix ";
|
||||
@ -10,7 +10,7 @@ Bool CheckDskConfirm(Bool *_fix,Bool *_confirm)
|
||||
return *_fix;
|
||||
}
|
||||
|
||||
I64 RedSeaCheckDskList(CDrive *dv,CDirEntry *tmpde1,
|
||||
I64 RedSeaCheckDiskList(CDrive *drive,CDirEntry *tmpde1,
|
||||
U8 *bits,U8 *bits2,I64 size,I64 bpc)
|
||||
{
|
||||
CDirEntry *tmpde2;
|
||||
@ -18,21 +18,21 @@ I64 RedSeaCheckDskList(CDrive *dv,CDirEntry *tmpde1,
|
||||
while (tmpde1) {
|
||||
tmpde2=tmpde1->next;
|
||||
if (tmpde1->attr & RS_ATTR_DIR && tmpde1->sub)
|
||||
errs+=RedSeaCheckDskList(dv,tmpde1->sub,bits,bits2,size,bpc);
|
||||
errs+=RedSeaCheckDiskList(drive,tmpde1->sub,bits,bits2,size,bpc);
|
||||
j=(tmpde1->size+bpc-1)/bpc;
|
||||
for (i=0;i<j;i++) {
|
||||
if (i+tmpde1->clus-dv->data_area>size) {
|
||||
if (i+tmpde1->clus-drive->data_area>size) {
|
||||
PrintErr("Invalid Clus:%s Clus:%X\n",tmpde1->full_name,
|
||||
i+tmpde1->clus);
|
||||
errs++;
|
||||
break;
|
||||
}
|
||||
if (LBts(bits,i+tmpde1->clus-dv->data_area)) {
|
||||
if (LBts(bits,i+tmpde1->clus-drive->data_area)) {
|
||||
PrintErr("Dbl Alloc:%s Clus:%X\n",tmpde1->full_name,
|
||||
i+tmpde1->clus);
|
||||
errs++;
|
||||
}
|
||||
if (!LBtr(bits2,i+tmpde1->clus-dv->data_area)) {
|
||||
if (!LBtr(bits2,i+tmpde1->clus-drive->data_area)) {
|
||||
PrintErr("UnAlloc:%s Clus:%X\n",tmpde1->full_name,
|
||||
i+tmpde1->clus);
|
||||
errs++;
|
||||
@ -44,54 +44,54 @@ I64 RedSeaCheckDskList(CDrive *dv,CDirEntry *tmpde1,
|
||||
return errs;
|
||||
}
|
||||
|
||||
I64 RedSeaCheckDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
I64 RedSeaCheckDisk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
{
|
||||
I64 i,j,bpc,size,errs=0;
|
||||
CDrive *dv=Letter2Drive(drv_let),*old_dv=Fs->cur_dv;
|
||||
U8 *files_find_mask=MStrPrint("%c:/*",Drive2Letter(dv)),
|
||||
CDrive *drive=Letter2Drive(drv_let),*old_dv=Fs->cur_dv;
|
||||
U8 *files_find_mask=MStrPrint("%c:/*",Drive2Letter(drive)),
|
||||
*old_dir=StrNew(Fs->cur_dir),
|
||||
*bits,*bits2;
|
||||
CDirEntry *ptr,*ptr2;
|
||||
|
||||
Drive(drv_let);
|
||||
"Scanning...\n";
|
||||
size=(dv->size-(dv->data_area-dv->drv_offset))/dv->spc;
|
||||
bpc=dv->spc<<BLK_SIZE_BITS;
|
||||
size=(drive->size-(drive->data_area-drive->drv_offset))/drive->spc;
|
||||
bpc=drive->spc<<BLK_SIZE_BITS;
|
||||
bits=CAlloc((size+7)>>3);
|
||||
bits2=CAlloc((size+7)>>3+BLK_SIZE);
|
||||
BlkRead(dv,bits2,dv->fat1,((size+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS);
|
||||
BlkRead(drive,bits2,drive->fat1,((size+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS);
|
||||
|
||||
//Get Root Dir size
|
||||
ptr2=MAlloc(bpc);
|
||||
BlkRead(dv,ptr2,dv->root_clus,1);
|
||||
BlkRead(drive,ptr2,drive->root_clus,1);
|
||||
ptr=ptr2(U8 *)-offset(CDirEntry.start);
|
||||
j=(ptr->size+bpc-1)/bpc;
|
||||
Free(ptr2);
|
||||
|
||||
for (i=0;i<j;i++) {
|
||||
if (i+dv->root_clus-dv->data_area>size) {
|
||||
PrintErr("Invalid Clus: RootDir Clus:%X\n",i+dv->root_clus);
|
||||
if (i+drive->root_clus-drive->data_area>size) {
|
||||
PrintErr("Invalid Clus: RootDir Clus:%X\n",i+drive->root_clus);
|
||||
errs++;
|
||||
break;
|
||||
}
|
||||
if (LBts(bits,i+dv->root_clus-dv->data_area)) {
|
||||
PrintErr("Dbl Alloc: RootDir Clus:%X\n",i+dv->root_clus);
|
||||
if (LBts(bits,i+drive->root_clus-drive->data_area)) {
|
||||
PrintErr("Dbl Alloc: RootDir Clus:%X\n",i+drive->root_clus);
|
||||
errs++;
|
||||
}
|
||||
if (!LBtr(bits2,i+dv->root_clus-dv->data_area)) {
|
||||
PrintErr("UnAlloc: RootDir Clus:%X\n",i+dv->root_clus);
|
||||
if (!LBtr(bits2,i+drive->root_clus-drive->data_area)) {
|
||||
PrintErr("UnAlloc: RootDir Clus:%X\n",i+drive->root_clus);
|
||||
errs++;
|
||||
}
|
||||
}
|
||||
|
||||
errs+=RedSeaCheckDskList(dv,FilesFind(files_find_mask,FUF_RECURSE),
|
||||
errs+=RedSeaCheckDiskList(drive,FilesFind(files_find_mask,FUF_RECURSE),
|
||||
bits,bits2,size,bpc);
|
||||
for (i=1;i<size;i++)
|
||||
if (Bt(bits2,i)) {
|
||||
PrintWarn("Shouldn't Alloc Clus:%0X\n",i+dv->data_area);
|
||||
PrintWarn("Shouldn't Alloc Clus:%0X\n",i+drive->data_area);
|
||||
errs++;
|
||||
if (CheckDskConfirm(_fix,_confirm))
|
||||
RedSeaFreeClus(dv,i+dv->data_area,1);
|
||||
if (CheckDiskConfirm(_fix,_confirm))
|
||||
RedSeaFreeClus(drive,i+drive->data_area,1);
|
||||
}
|
||||
|
||||
Free(files_find_mask);
|
||||
@ -103,7 +103,7 @@ I64 RedSeaCheckDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
return errs;
|
||||
}
|
||||
|
||||
I64 FAT32CheckDskList(CDrive *dv,CDirEntry *tmpde1,
|
||||
I64 FAT32CheckDiskList(CDrive *drive,CDirEntry *tmpde1,
|
||||
U8 *bits,U32 *bits2,I64 size,I64 bpc)
|
||||
{
|
||||
CDirEntry *tmpde2;
|
||||
@ -111,7 +111,7 @@ I64 FAT32CheckDskList(CDrive *dv,CDirEntry *tmpde1,
|
||||
while (tmpde1) {
|
||||
tmpde2=tmpde1->next;
|
||||
if (tmpde1->attr & RS_ATTR_DIR && tmpde1->sub)
|
||||
errs+=FAT32CheckDskList(dv,tmpde1->sub,bits,bits2,size,bpc);
|
||||
errs+=FAT32CheckDiskList(drive,tmpde1->sub,bits,bits2,size,bpc);
|
||||
i=0;
|
||||
c=tmpde1->clus;
|
||||
while (0<c<0x0FFFFFF8) {
|
||||
@ -129,7 +129,7 @@ I64 FAT32CheckDskList(CDrive *dv,CDirEntry *tmpde1,
|
||||
errs++;
|
||||
} else
|
||||
bits2[c]=0;
|
||||
c=ClusNumNext(dv,c);
|
||||
c=ClusNumNext(drive,c);
|
||||
i++;
|
||||
}
|
||||
if (!(tmpde1->attr & RS_ATTR_DIR)) {
|
||||
@ -149,23 +149,23 @@ I64 FAT32CheckDskList(CDrive *dv,CDirEntry *tmpde1,
|
||||
return errs;
|
||||
}
|
||||
|
||||
I64 FAT32CheckDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
I64 FAT32CheckDisk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
{
|
||||
I64 i,bpc,size,c,errs=0;
|
||||
CDrive *dv=Letter2Drive(drv_let),*old_dv=Fs->cur_dv;
|
||||
U8 *files_find_mask=MStrPrint("%c:/*",Drive2Letter(dv)),
|
||||
CDrive *drive=Letter2Drive(drv_let),*old_dv=Fs->cur_dv;
|
||||
U8 *files_find_mask=MStrPrint("%c:/*",Drive2Letter(drive)),
|
||||
*old_dir=StrNew(Fs->cur_dir),
|
||||
*bits;
|
||||
U32 *bits2;
|
||||
Drive(drv_let);
|
||||
"Scanning...\n";
|
||||
size=(dv->size-(dv->data_area-dv->drv_offset))/dv->spc;
|
||||
bpc=dv->spc<<BLK_SIZE_BITS;
|
||||
size=(drive->size-(drive->data_area-drive->drv_offset))/drive->spc;
|
||||
bpc=drive->spc<<BLK_SIZE_BITS;
|
||||
bits=CAlloc((size+7)>>3);
|
||||
bits2=CAlloc(size*4+BLK_SIZE);
|
||||
BlkRead(dv,bits2,dv->fat1,(size*4+BLK_SIZE-1)>>BLK_SIZE_BITS);
|
||||
BlkRead(drive,bits2,drive->fat1,(size*4+BLK_SIZE-1)>>BLK_SIZE_BITS);
|
||||
|
||||
c=dv->root_clus;
|
||||
c=drive->root_clus;
|
||||
while (0<c<0x0FFFFFF8) {
|
||||
if (c>size) {
|
||||
PrintErr("Invalid Clus: RootDir Clus:%X\n",c);
|
||||
@ -181,10 +181,10 @@ I64 FAT32CheckDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
errs++;
|
||||
} else
|
||||
bits2[c]=0;
|
||||
c=ClusNumNext(dv,c);
|
||||
c=ClusNumNext(drive,c);
|
||||
}
|
||||
|
||||
errs+=FAT32CheckDskList(dv,FilesFind(files_find_mask,FUF_RECURSE),
|
||||
errs+=FAT32CheckDiskList(drive,FilesFind(files_find_mask,FUF_RECURSE),
|
||||
bits,bits2,size,bpc);
|
||||
|
||||
bits2[1]=0; //See $LK,"FAT32Fmt",A="MN:FAT32Fmt"$()
|
||||
@ -192,8 +192,8 @@ I64 FAT32CheckDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
if (bits2[i]) {
|
||||
PrintWarn("Shouldn't Alloc Clus:%0X\n",i);
|
||||
errs++;
|
||||
if (CheckDskConfirm(_fix,_confirm))
|
||||
FAT32FreeClus(dv,i);
|
||||
if (CheckDiskConfirm(_fix,_confirm))
|
||||
FAT32FreeClus(drive,i);
|
||||
}
|
||||
Free(files_find_mask);
|
||||
Free(bits);
|
||||
@ -208,13 +208,13 @@ public I64 DiskCheck(U8 drv_let=0,Bool fix=FALSE,Bool confirm=TRUE)
|
||||
{//Check disk for allocation errors and, optionally, fix.
|
||||
//You probably want to reformat and reinstall.
|
||||
I64 errs=0;
|
||||
CDrive *dv=Letter2Drive(drv_let);
|
||||
switch (dv->fs_type) {
|
||||
CDrive *drive=Letter2Drive(drv_let);
|
||||
switch (drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
errs=RedSeaCheckDsk(drv_let,&fix,&confirm);
|
||||
errs=RedSeaCheckDisk(drv_let,&fix,&confirm);
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
errs=FAT32CheckDsk(drv_let,&fix,&confirm);
|
||||
errs=FAT32CheckDisk(drv_let,&fix,&confirm);
|
||||
break;
|
||||
default:
|
||||
PrintErr("File System Not Supported\n");
|
||||
@ -231,9 +231,9 @@ public I64 DiskCheck(U8 drv_let=0,Bool fix=FALSE,Bool confirm=TRUE)
|
||||
|
||||
U0 RedSeaDriveView(U8 drv_let=0)
|
||||
{
|
||||
CDrive *dv=Letter2Drive(drv_let);
|
||||
CDrive *drive=Letter2Drive(drv_let);
|
||||
I64 lohi,c1,i,x,y,l=(GR_HEIGHT-3*FONT_HEIGHT)*(GR_WIDTH-FONT_WIDTH<<1),
|
||||
s=dv->size+dv->drv_offset-dv->data_area;
|
||||
s=drive->size+drive->drv_offset-drive->data_area;
|
||||
U8 *bitmap;
|
||||
CDC *dc=DCAlias;
|
||||
|
||||
@ -246,7 +246,7 @@ U0 RedSeaDriveView(U8 drv_let=0)
|
||||
try {
|
||||
i=((s+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
bitmap=MAlloc(i<<BLK_SIZE_BITS);
|
||||
BlkRead(dv,bitmap,dv->fat1,i);
|
||||
BlkRead(drive,bitmap,drive->fat1,i);
|
||||
i=0;
|
||||
for (y=0;y<GR_HEIGHT-3*FONT_HEIGHT;y++) {
|
||||
if (ScanKey)
|
||||
@ -264,7 +264,7 @@ U0 RedSeaDriveView(U8 drv_let=0)
|
||||
}
|
||||
Free(bitmap);
|
||||
} catch
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
GetChar;
|
||||
|
||||
SettingsPop;
|
||||
@ -273,9 +273,9 @@ U0 RedSeaDriveView(U8 drv_let=0)
|
||||
}
|
||||
U0 FAT32DriveView(U8 drv_let=0)
|
||||
{
|
||||
CDrive *dv=Letter2Drive(drv_let);
|
||||
CDrive *drive=Letter2Drive(drv_let);
|
||||
I64 lohi,c1,i,x,y,l=(GR_HEIGHT-3*FONT_HEIGHT)*(GR_WIDTH-FONT_WIDTH<<1),
|
||||
s=(dv->size+dv->spc-1)/dv->spc-(2+dv->data_area-dv->drv_offset);
|
||||
s=(drive->size+drive->spc-1)/drive->spc-(2+drive->data_area-drive->drv_offset);
|
||||
U32 *bitmap;
|
||||
CDC *dc=DCAlias;
|
||||
|
||||
@ -288,7 +288,7 @@ U0 FAT32DriveView(U8 drv_let=0)
|
||||
try {
|
||||
i=(s*4+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
bitmap=MAlloc(i<<BLK_SIZE_BITS);
|
||||
BlkRead(dv,bitmap,dv->fat1,i);
|
||||
BlkRead(drive,bitmap,drive->fat1,i);
|
||||
i=0;
|
||||
for (y=0;y<GR_HEIGHT-3*FONT_HEIGHT;y++) {
|
||||
if (ScanKey)
|
||||
@ -306,7 +306,7 @@ U0 FAT32DriveView(U8 drv_let=0)
|
||||
}
|
||||
Free(bitmap);
|
||||
} catch
|
||||
DriveUnlock(dv);
|
||||
DriveUnlock(drive);
|
||||
GetChar;
|
||||
|
||||
SettingsPop;
|
||||
@ -315,9 +315,9 @@ U0 FAT32DriveView(U8 drv_let=0)
|
||||
}
|
||||
public U0 DriveView(U8 drv_let=0)
|
||||
{//Drive view. Graph the allocation map's fragmentation.
|
||||
CDrive *dv=Letter2Drive(drv_let),*old_dv=Fs->cur_dv;
|
||||
CDrive *drive=Letter2Drive(drv_let),*old_dv=Fs->cur_dv;
|
||||
Drive(drv_let);
|
||||
switch (dv->fs_type) {
|
||||
switch (drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
RedSeaDriveView(drv_let);
|
||||
break;
|
||||
@ -336,7 +336,7 @@ public U0 DiskView(U8 drv_let=0)
|
||||
h=Fs->pix_width,
|
||||
v=Fs->pix_height,
|
||||
radius;
|
||||
CDrive *dv;
|
||||
CDrive *drive;
|
||||
CBlkDev *bd=Letter2BlkDev(drv_let);
|
||||
CDC *dc=DCAlias;
|
||||
F64 sect_start,sect_end;
|
||||
@ -353,11 +353,11 @@ public U0 DiskView(U8 drv_let=0)
|
||||
GrCircle(dc,h>>1,v>>1,radius);
|
||||
|
||||
j=1;
|
||||
for (i=0;i<DRVS_NUM;i++) {
|
||||
dv=&blkdev.drvs[i];
|
||||
if (bd==dv->bd && dv->fs_type) {
|
||||
sect_start=-(dv->drv_offset*2*ã/(bd->max_blk+1));
|
||||
sect_end =-((dv->drv_offset+dv->size)*2*ã/(bd->max_blk+1));
|
||||
for (i=0;i<DRIVES_NUM;i++) {
|
||||
drive=&blkdev.drvs[i];
|
||||
if (bd==drive->bd && drive->fs_type) {
|
||||
sect_start=-(drive->drv_offset*2*ã/(bd->max_blk+1));
|
||||
sect_end =-((drive->drv_offset+drive->size)*2*ã/(bd->max_blk+1));
|
||||
dc->color=BLACK;
|
||||
GrLine(dc,h>>1,v>>1,
|
||||
h>>1+radius*Cos(sect_start),
|
||||
@ -366,10 +366,10 @@ public U0 DiskView(U8 drv_let=0)
|
||||
h>>1+radius*Cos(sect_end),
|
||||
v>>1+radius*Sin(sect_end));
|
||||
|
||||
attr=DriveTextAttrGet(Drive2Letter(dv));
|
||||
attr=DriveTextAttrGet(Drive2Letter(drive));
|
||||
dc->color=attr&15;
|
||||
GrPrint(dc,0,v-FONT_HEIGHT*j,"%C %-8Z",Drive2Letter(dv),
|
||||
dv->fs_type,"ST_DRV_TYPES");
|
||||
GrPrint(dc,0,v-FONT_HEIGHT*j,"%C %-8Z",Drive2Letter(drive),
|
||||
drive->fs_type,"ST_DRIVE_TYPES");
|
||||
dc->color.c1=attr>>4;
|
||||
dc->color|=ROPF_DITHER;
|
||||
GrFloodFill(dc,
|
||||
@ -387,47 +387,47 @@ public U0 DiskView(U8 drv_let=0)
|
||||
|
||||
I64 RedSeaUnusedDriveSpace(U8 drv_let=0)
|
||||
{
|
||||
CDrive *dv=Letter2Drive(drv_let);
|
||||
CDrive *drive=Letter2Drive(drv_let);
|
||||
I64 res=0,i,l;
|
||||
U8 *bitmap;
|
||||
try {
|
||||
l=dv->size+dv->drv_offset-dv->data_area;
|
||||
l=drive->size+drive->drv_offset-drive->data_area;
|
||||
i=((l+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
bitmap=MAlloc(i<<BLK_SIZE_BITS);
|
||||
BlkRead(dv,bitmap,dv->fat1,i);
|
||||
BlkRead(drive,bitmap,drive->fat1,i);
|
||||
for (i=0;i<l;i++)
|
||||
if (!Bt(bitmap,i))
|
||||
res++;
|
||||
Free(bitmap);
|
||||
} catch
|
||||
DriveUnlock(dv);
|
||||
return res*BLK_SIZE*dv->spc;
|
||||
DriveUnlock(drive);
|
||||
return res*BLK_SIZE*drive->spc;
|
||||
}
|
||||
I64 FAT32UnusedDriveSpace(U8 drv_let=0)
|
||||
{
|
||||
CDrive *dv=Letter2Drive(drv_let);
|
||||
CDrive *drive=Letter2Drive(drv_let);
|
||||
I64 res=0,i,l;
|
||||
U32 *bitmap;
|
||||
try {
|
||||
l=(dv->size+dv->spc-1)/dv->spc-(2+dv->data_area-dv->drv_offset);
|
||||
l=(drive->size+drive->spc-1)/drive->spc-(2+drive->data_area-drive->drv_offset);
|
||||
i=(l*4+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
bitmap=MAlloc(i<<BLK_SIZE_BITS);
|
||||
BlkRead(dv,bitmap,dv->fat1,i);
|
||||
BlkRead(drive,bitmap,drive->fat1,i);
|
||||
for (i=0;i<l;i++)
|
||||
if (!bitmap[i])
|
||||
res++;
|
||||
Free(bitmap);
|
||||
} catch
|
||||
DriveUnlock(dv);
|
||||
return res*BLK_SIZE*dv->spc;
|
||||
DriveUnlock(drive);
|
||||
return res*BLK_SIZE*drive->spc;
|
||||
}
|
||||
public I64 DriveUnused(U8 drv_let=0)
|
||||
{//Returns unused size in bytes.
|
||||
CDrive *dv=Letter2Drive(drv_let),*old_dv=Fs->cur_dv;
|
||||
CDrive *drive=Letter2Drive(drv_let),*old_dv=Fs->cur_dv;
|
||||
U8 *old_dir=StrNew(Fs->cur_dir);
|
||||
I64 res=0;
|
||||
Drive(drv_let);
|
||||
switch (dv->fs_type) {
|
||||
switch (drive->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
res=RedSeaUnusedDriveSpace(drv_let);
|
||||
break;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically)"
|
||||
|
||||
#define ROUND_DRV_TO (63*255)
|
||||
#define DRV_HEADER 63
|
||||
#define ROUND_DRIVE_TO (63*255)
|
||||
#define DRIVE_HEADER 63
|
||||
|
||||
class CPlannedDrive
|
||||
{
|
||||
@ -10,12 +10,12 @@ class CPlannedDrive
|
||||
Bool pri;
|
||||
};
|
||||
|
||||
public I64 DiskPrt(U8 drv_let=0,...)
|
||||
public I64 DiskPart(U8 drv_let=0,...)
|
||||
{/*Partition the disk containing partition drv_let.
|
||||
|
||||
drv_let=0 means add new drive that is not already mounted.
|
||||
|
||||
>DiskPrt('C',0.5,0.25,0.25); //Make three. 50% C, 25% D, 25% E, round-up to blk.
|
||||
>DiskPart('C',0.5,0.25,0.25); //Make three. 50% C, 25% D, 25% E, round-up to blk.
|
||||
|
||||
*/
|
||||
CBlkDev *bd;
|
||||
@ -46,9 +46,9 @@ drv_let=0 means add new drive that is not already mounted.
|
||||
|
||||
total=bd->max_blk+1;
|
||||
QueueInit(&head);
|
||||
drv_let2=bd->first_drv_let;
|
||||
remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO);
|
||||
while (FloorU64(remaining,ROUND_DRV_TO)>=ROUND_DRV_TO) {
|
||||
drv_let2=bd->first_drive_let;
|
||||
remaining=FloorU64(bd->max_blk+1,ROUND_DRIVE_TO);
|
||||
while (FloorU64(remaining,ROUND_DRIVE_TO)>=ROUND_DRIVE_TO) {
|
||||
tmppp=MAlloc(sizeof(CPlannedDrive));
|
||||
do {
|
||||
"$$RED$$Partition %C$$FG$$\n",drv_let2;
|
||||
@ -64,14 +64,14 @@ drv_let=0 means add new drive that is not already mounted.
|
||||
pri=FALSE;
|
||||
}
|
||||
"\nBlocks Remaining:%d (0x%X)\n",
|
||||
remaining-DRV_HEADER,remaining-DRV_HEADER;
|
||||
remaining-DRIVE_HEADER,remaining-DRIVE_HEADER;
|
||||
if (argc>cur_arg)
|
||||
tmppp->size=MinI64(CeilU64(MaxI64(remaining,DRV_HEADER),ROUND_DRV_TO),
|
||||
CeilU64(argv[cur_arg++](F64)*total,ROUND_DRV_TO));
|
||||
tmppp->size=MinI64(CeilU64(MaxI64(remaining,DRIVE_HEADER),ROUND_DRIVE_TO),
|
||||
CeilU64(argv[cur_arg++](F64)*total,ROUND_DRIVE_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)));
|
||||
remaining-DRIVE_HEADER)+DRIVE_HEADER,ROUND_DRIVE_TO);
|
||||
} while (!(ROUND_DRIVE_TO<=tmppp->size<=FloorU64(remaining,ROUND_DRIVE_TO)));
|
||||
QueueInsert(tmppp,head.last);
|
||||
remaining-=tmppp->size;
|
||||
drv_let2++;
|
||||
@ -79,7 +79,7 @@ drv_let=0 means add new drive that is not already mounted.
|
||||
|
||||
"\n\n!!! Repartition Drive !!!\n\n";
|
||||
tmppp=head.next;
|
||||
drv_let2=bd->first_drv_let;
|
||||
drv_let2=bd->first_drive_let;
|
||||
while (tmppp!=&head) {
|
||||
"Drive %C:%08X ",drv_let2,tmppp->size;
|
||||
if (tmppp->pri)
|
||||
@ -92,7 +92,7 @@ drv_let=0 means add new drive that is not already mounted.
|
||||
if (!argc && !AreYouSure)
|
||||
goto pd_done;
|
||||
|
||||
remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO)-ROUND_DRV_TO;
|
||||
remaining=FloorU64(bd->max_blk+1,ROUND_DRIVE_TO)-ROUND_DRIVE_TO;
|
||||
tmppp=head.next;
|
||||
MemSet(&mbr,0,BLK_SIZE);
|
||||
mbr.signature=0xAA55;
|
||||
@ -104,8 +104,8 @@ drv_let=0 means add new drive that is not already mounted.
|
||||
mbr.p[i].type=1; //Will get set different.
|
||||
mbr.p[i].end_head=0xFE;
|
||||
mbr.p[i].end_cyl=0xFFFF;
|
||||
mbr.p[i].offset=DRV_HEADER+offset;
|
||||
mbr.p[i].size=tmppp->size-DRV_HEADER;
|
||||
mbr.p[i].offset=DRIVE_HEADER+offset;
|
||||
mbr.p[i].size=tmppp->size-DRIVE_HEADER;
|
||||
offset+=tmppp->size;
|
||||
remaining-=tmppp->size;
|
||||
tmppp=tmppp->next;
|
||||
@ -135,8 +135,8 @@ drv_let=0 means add new drive that is not already mounted.
|
||||
mbr.p[0].type=1; //Will get set different.
|
||||
mbr.p[0].end_head=0xFE;
|
||||
mbr.p[0].end_cyl=0xFFFF;
|
||||
mbr.p[0].offset=DRV_HEADER;
|
||||
mbr.p[0].size=tmppp->size-DRV_HEADER;
|
||||
mbr.p[0].offset=DRIVE_HEADER;
|
||||
mbr.p[0].size=tmppp->size-DRIVE_HEADER;
|
||||
offset+=tmppp->size;
|
||||
tmppp=tmppp->next;
|
||||
if (tmppp!=&head) {
|
||||
@ -154,7 +154,7 @@ drv_let=0 means add new drive that is not already mounted.
|
||||
|
||||
bd->flags&=~(BDF_INITIALIZED | BDF_INIT_IN_PROGRESS);
|
||||
BlkDevAdd(bd,,FALSE,TRUE);
|
||||
for (i=bd->first_drv_let;i<drv_let2;i++)
|
||||
for (i=bd->first_drive_let;i<drv_let2;i++)
|
||||
Fmt(i,,FALSE);
|
||||
|
||||
pd_done:
|
@ -146,7 +146,7 @@ CDirEntry *FMRebuildDocDrive(U8 drv_let,CDoc *doc,CDirEntry **_head,Bool init)
|
||||
|
||||
U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_head,I64 mode)
|
||||
{
|
||||
CDrive *dv;
|
||||
CDrive *drive;
|
||||
I64 i;
|
||||
CDoc *doc=*_doc,*doc2=sys_clip_doc,*parent_doc;
|
||||
CFMUncollapsedList *tmpc=NULL;
|
||||
@ -218,17 +218,17 @@ U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_head,I64 mode)
|
||||
break;
|
||||
}
|
||||
DocPrint(doc,"$$LTBLUE$$");
|
||||
for (i=0;i<DRVS_NUM;i++) {
|
||||
dv=&blkdev.drvs[i];
|
||||
if (dv->bd->type==BDT_ATAPI) {
|
||||
if (dv->bd->flags&BDF_INITIALIZED)
|
||||
tmpde=FMRebuildDocDrive(Drive2Letter(dv),doc,_head,TRUE);
|
||||
for (i=0;i<DRIVES_NUM;i++) {
|
||||
drive=&blkdev.drvs[i];
|
||||
if (drive->bd->type==BDT_ATAPI) {
|
||||
if (drive->bd->flags&BDF_INITIALIZED)
|
||||
tmpde=FMRebuildDocDrive(Drive2Letter(drive),doc,_head,TRUE);
|
||||
else {
|
||||
tmpde=FMRebuildDocDrive(Drive2Letter(dv),doc,_head,FALSE);
|
||||
tmpde=FMRebuildDocDrive(Drive2Letter(drive),doc,_head,FALSE);
|
||||
tmpde->user_data2|=DEF2_NOT_INITIALIZED;
|
||||
}
|
||||
} else if (dv->fs_type==FSt_REDSEA || dv->fs_type==FSt_FAT32)
|
||||
FMRebuildDocDrive(Drive2Letter(dv),doc,_head,TRUE);
|
||||
} else if (drive->fs_type==FSt_REDSEA || drive->fs_type==FSt_FAT32)
|
||||
FMRebuildDocDrive(Drive2Letter(drive),doc,_head,TRUE);
|
||||
}
|
||||
DocTop(doc);
|
||||
FMMarkUncollapsed(doc,tmpc,cur_entry,next_entry);
|
||||
@ -326,7 +326,7 @@ U0 FMDelete(CDoc *doc)
|
||||
}
|
||||
}
|
||||
|
||||
U0 FMChgDsk(CDoc *doc)
|
||||
U0 FMChangeDisk(CDoc *doc)
|
||||
{
|
||||
CDocEntry *doc_ce=doc->cur_entry;
|
||||
CDirEntry *tmpde;
|
||||
@ -338,7 +338,7 @@ U0 FMChgDsk(CDoc *doc)
|
||||
while (tmpde->parent)
|
||||
tmpde=tmpde->parent;
|
||||
Silent;
|
||||
DiskChg(*tmpde->full_name);
|
||||
DiskChange(*tmpde->full_name);
|
||||
Silent(OFF);
|
||||
}
|
||||
}
|
||||
@ -481,7 +481,7 @@ U0 FMCopy(CDoc *doc)
|
||||
#define FMR_MKDIR 4
|
||||
#define FMR_PLAIN 5
|
||||
#define FMR_PASTE 6
|
||||
#define FMR_CHG_DSK 7
|
||||
#define FMR_CHG_DISK 7
|
||||
#define FMR_FORMAT 8
|
||||
#define FMR_MOUNT_REDSEA_ISO_C 9
|
||||
#define FMR_UNMOUNT 10
|
||||
@ -501,7 +501,7 @@ I64 PopUpFMRight(U8 *header=NULL,U8 *footer=NULL)
|
||||
"$$CM+LX,1,3 $$$$BT,\"MAKEDIRECTORY\",LE=FMR_MKDIR$$"
|
||||
"$$CM+LX,29,0$$$$BT,\"PLAIN-TEXTEDIT\",LE=FMR_PLAIN$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"PASTECLIPFILES\",LE=FMR_PASTE$$"
|
||||
"$$CM+LX,29,0$$$$BT,\"CHANGEDISK(MOUNTIT)\",LE=FMR_CHG_DSK$$"
|
||||
"$$CM+LX,29,0$$$$BT,\"CHANGEDISK(MOUNTIT)\",LE=FMR_CHG_DISK$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"FORMAT\",LE=FMR_FORMAT$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"MOUNTISO.CFILE\","
|
||||
"LE=FMR_MOUNT_REDSEA_ISO_C$$"
|
||||
@ -540,7 +540,7 @@ U0 FMRightClick()
|
||||
case FMR_PASTE:
|
||||
Message(MESSAGE_KEY_DOWN,0,SC_INS+SCF_SHIFT);
|
||||
break;
|
||||
case FMR_CHG_DSK:
|
||||
case FMR_CHG_DISK:
|
||||
Message(MESSAGE_KEY_DOWN,'c',0);
|
||||
break;
|
||||
case FMR_FORMAT:
|
||||
@ -701,7 +701,7 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
FMDelete(doc);
|
||||
break;
|
||||
case 'c':
|
||||
FMChgDsk(doc);
|
||||
FMChangeDisk(doc);
|
||||
break;
|
||||
case 'i':
|
||||
FMMountISO(doc);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user