*** t:,RDFt1A14ed8 Sun Mar 11 12:00:39 1990 --- device.c Sun Mar 11 11:42:28 1990 *************** *** 1,9 **** /*- ! * $Id: device.c,v 1.5 90/01/27 20:34:43 Rhialto Rel $ * $Log: device.c,v $ * Revision 1.5 90/01/27 20:34:43 Rhialto * Commented out #undef DEBUG ! * * Revision 1.4 90/01/23 00:24:50 Rhialto * io_Error=0 for immediate commands * --- 1,12 ---- /*- ! * $Id: device.c,v 1.6 90/03/11 17:42:06 Rhialto Rel $ * $Log: device.c,v $ + * Revision 1.6 90/03/11 17:42:06 Rhialto + * No change. + * * Revision 1.5 90/01/27 20:34:43 Rhialto * Commented out #undef DEBUG ! * * Revision 1.4 90/01/23 00:24:50 Rhialto * io_Error=0 for immediate commands * *************** *** 66,72 **** /* INDENT ON */ char DevName[] = "messydisk.device"; ! char idString[] = "messydisk.device $Revision: 1.5 $ $Date: 90/01/27 20:34:43 $\r\n"; /* * -30-6*X Library vectors: --- 69,75 ---- /* INDENT ON */ char DevName[] = "messydisk.device"; ! char idString[] = "messydisk.device $Revision: 1.6 $ $Date: 90/03/11 17:42:06 $\r\n"; /* * -30-6*X Library vectors: *** t:,RDFt1A14ed8 Sun Mar 11 12:00:57 1990 --- hanmain.c Sun Mar 11 11:43:00 1990 *************** *** 1,16 **** /*- ! * $Id: hanmain.c,v 1.4 90/01/27 20:13:00 Rhialto Rel $ * $Log: hanmain.c,v $ ! * Revision 1.4 90/01/27 20:13:00 Rhialto ! * *** empty log message *** * ! * Revision 1.3 89/12/17 21:29:51 Rhialto ! * *** empty log message *** ! * * Revision 1.1 89/12/17 20:02:31 Rhialto - * Initial revision * - * * HANMAIN.C * * The code for the messydos file system handler. --- 1,12 ---- /*- ! * $Id: hanmain.c,v 1.5 90/03/11 17:42:29 Rhialto Rel $ * $Log: hanmain.c,v $ ! * Revision 1.5 90/03/11 17:42:29 Rhialto ! * Patch1 * ! * Revision 1.4 90/01/27 20:13:00 Rhialto * Revision 1.1 89/12/17 20:02:31 Rhialto * * HANMAIN.C * * The code for the messydos file system handler. *************** *** 22,31 **** * not be used or copied without a licence. -*/ - #include "han.h" #include "dos.h" ! #ifdef DEBUG # define debug(x) dbprintf x #else # define debug(x) --- 18,27 ---- * not be used or copied without a licence. -*/ #include "dos.h" + #include "han.h" ! #ifdef HDEBUG # define debug(x) dbprintf x #else # define debug(x) *************** *** 33,39 **** extern char DotDot[1 + 8 + 3]; struct Library *IntuitionBase; ! static char RCSId[] = "Messydos filing system $Revision: 1.4 $ $Date: 90/01/27 20:13:00 $, by Olaf Seibert"; byte ToUpper(ch) --- 29,35 ---- extern char DotDot[1 + 8 + 3]; struct Library *IntuitionBase; ! static char RCSId[] = "Messydos filing system $Revision: 1.5 $ $Date: 90/03/11 17:42:29 $, by Olaf Seibert"; byte ToUpper(ch) *************** *** 225,231 **** debug(("MSDiskRemoved with no RootLock\n")); return 1; } ! #ifdef DEBUG if (RootLock != GetTail(&LockList->ll_List)) { debug(("RootLock not at end of LockList!\n")); /* Get the lock on the root dir at the tail of the List */ --- 221,227 ---- debug(("MSDiskRemoved with no RootLock\n")); return 1; } ! #ifdef HDEBUG if (RootLock != GetTail(&LockList->ll_List)) { debug(("RootLock not at end of LockList!\n")); /* Get the lock on the root dir at the tail of the List */ *************** *** 255,261 **** void HanCloseDown() { ! #ifdef DEBUG register struct MSFileLock *fl; while (LockList && (fl = (struct MSFileLock *) GetHead(&LockList->ll_List))) { --- 251,257 ---- void HanCloseDown() { ! #ifdef HDEBUG register struct MSFileLock *fl; while (LockList && (fl = (struct MSFileLock *) GetHead(&LockList->ll_List))) { *************** *** 304,310 **** TimeIOReq = NULL; ! #ifdef DEBUG if (!(DiskReplyPort = CreatePort("MSH:disk.replyport", -1L))) goto abort; #else --- 300,306 ---- TimeIOReq = NULL; ! #ifdef HDEBUG if (!(DiskReplyPort = CreatePort("MSH:disk.replyport", -1L))) goto abort; #else *************** *** 444,450 **** #endif } ! #ifdef DEBUG _abort() { --- 440,446 ---- #endif } ! #ifdef HDEBUG _abort() { *************** *** 452,455 **** RemTask(NULL); } ! #endif /* DEBUG */ --- 448,451 ---- RemTask(NULL); } ! #endif /* HDEBUG */ *** t:,RDFt1A14ed8 Sun Mar 11 12:01:17 1990 --- messyfmt.c Sun Mar 11 11:43:28 1990 *************** *** 236,241 **** --- 236,242 ---- ncylinders, ndirs, wholeDisk, + clearFat, endtrack; if (argc < 2) { *************** *** 263,268 **** --- 264,271 ---- printf("Cannot OpenDevice %s\n", Device); goto abort3; } + + printf("Preparing to format disk in %s unit #%d.\n\n", Device, (int) unitNr); bps = input("Bytes per sector", bps); spt = input("Sectors per track", spt); TrackSize = bps * spt; *************** *** 292,297 **** --- 295,305 ---- SetWord(DiskTrack + 0x1c, "Number of hidden sectors", 0); wholeDisk = input("Format whole disk (enter 1)", 0); + if (!wholeDisk) + clearFat = input("Write how much then?\n" + " (enter 0 for just the bootblock)\n" + " (enter 1 for FAT and root directory as well)", 0); + if (input("Are you sure? (enter 42)", 0) != 42) goto abort5; *************** *** 298,303 **** --- 306,324 ---- if (Chk_Abort()) goto abort5; + if (!wholeDisk && !clearFat) { + puts("Writing bootblock only."); + TDReq->iotd_Req.io_Command = CMD_WRITE; + TDReq->iotd_Req.io_Data = (APTR) DiskTrack; + TDReq->iotd_Req.io_Length = sizeof (BootBlock); + TDReq->iotd_Req.io_Offset = 0; + DoIO(TDReq); + TDReq->iotd_Req.io_Command = CMD_UPDATE; + DoIO(TDReq); + + goto done; + } + /* Go to first FAT */ diskBlock = MaybeWrite(DiskTrack + bps * res); for (i = 0; i < nfats; i++) { *************** *** 319,324 **** --- 340,347 ---- break; } } + + done: TDReq->iotd_Req.io_Command = TD_MOTOR; TDReq->iotd_Req.io_Length = 0; DoIO(TDReq); *** t:,RDFt1A14ed8 Sun Mar 11 12:01:36 1990 --- hansec.c Sun Mar 11 11:43:49 1990 *************** *** 1,9 **** /*- ! * $Id: hansec.c,v 1.4 90/02/10 21:30:54 Rhialto Rel $ * $Log: hansec.c,v $ * Revision 1.4 90/02/10 21:30:54 Rhialto * Tuned cache a bit. ! * * Revision 1.3 90/01/27 20:20:16 Rhialto * Sorted sectors when flushing cache * --- 1,12 ---- /*- ! * $Id: hansec.c,v 1.5 90/03/11 17:43:29 Rhialto Rel $ * $Log: hansec.c,v $ + * Revision 1.5 90/03/11 17:43:29 Rhialto + * Patch1 + * * Revision 1.4 90/02/10 21:30:54 Rhialto * Tuned cache a bit. ! * * Revision 1.3 90/01/27 20:20:16 Rhialto * Sorted sectors when flushing cache * *************** *** 24,34 **** * May not be used or copied without a licence. -*/ - #include "han.h" #include "dos.h" ! /*#undef DEBUG /**/ ! #ifdef DEBUG # define debug(x) dbprintf x #else # define debug(x) --- 27,37 ---- * May not be used or copied without a licence. -*/ #include "dos.h" + #include "han.h" ! /*#undef HDEBUG /**/ ! #ifdef HDEBUG # define debug(x) dbprintf x #else # define debug(x) *************** *** 148,154 **** { register word entry; ! return (entry = GetFatEntry(cluster)) >= 0xFFF0 ? FAT_EOF : entry; } word --- 151,157 ---- { register word entry; ! return (entry = GetFatEntry(cluster)) >= 0xFFF7 ? FAT_EOF : entry; } word *************** *** 620,626 **** Disk.bpc = Disk.bps * Disk.spc; Disk.vollabel = FakeRootDirEntry; /* Disk.fat16bits = Disk.nsects > 20740; /* DOS3.2 magic value */ ! Disk.fat16bits = Disk.maxclst > 0xFF6; /* DOS3.0 magic value */ debug(("%x\tbytes per sector\n", Disk.bps)); debug(("%x\tsectors per cluster\n", Disk.spc)); --- 623,629 ---- Disk.bpc = Disk.bps * Disk.spc; Disk.vollabel = FakeRootDirEntry; /* Disk.fat16bits = Disk.nsects > 20740; /* DOS3.2 magic value */ ! Disk.fat16bits = Disk.maxclst >= 0xFF7; /* DOS3.0 magic value */ debug(("%x\tbytes per sector\n", Disk.bps)); debug(("%x\tsectors per cluster\n", Disk.spc)); *************** *** 667,673 **** IDDiskState = ID_WRITE_PROTECTED; } } ! #ifdef DEBUG else debug(("No disk inserted %d.\n", DiskIOReq->iotd_Req.io_Error)); #endif return 1; --- 670,676 ---- IDDiskState = ID_WRITE_PROTECTED; } } ! #ifdef HDEBUG else debug(("No disk inserted %d.\n", DiskIOReq->iotd_Req.io_Error)); #endif return 1; *** t:,RDFt1A14ed8 Sun Mar 11 12:01:56 1990 --- device.h Sun Mar 11 11:44:04 1990 *************** *** 1,5 **** /*- ! * $Id: device.h,v 1.2 90/01/27 20:39:10 Rhialto Rel $ * * This code is (C) Copyright 1989 by Olaf Seibert. All rights reserved. May * not be used or copied without a licence. --- 1,5 ---- /*- ! * $Id: device.h,v 1.3 90/03/11 17:43:50 Rhialto Rel $ * * This code is (C) Copyright 1989 by Olaf Seibert. All rights reserved. May * not be used or copied without a licence. *** t:,RDFt1A14ed8 Sun Mar 11 12:02:20 1990 --- devio.c Sun Mar 11 11:44:50 1990 *************** *** 1,15 **** /*- ! * $Id: devio.c,v 1.4 90/02/10 21:42:17 Rhialto Rel $ * $Log: devio.c,v $ * Revision 1.4 90/02/10 21:42:17 Rhialto * Small changes ! * * Revision 1.3 90/01/27 20:36:04 Rhialto * Variable #sectors/track! * - * Revision 1.2 90/01/23 00:41:39 Rhialto - * Remove C version of DecodeTrack. - * * Revision 1.1 89/12/17 20:04:11 Rhialto * * DEVIO.C --- 1,15 ---- /*- ! * $Id: devio.c,v 1.5 90/03/11 17:44:05 Rhialto Rel $ * $Log: devio.c,v $ + * Revision 1.5 90/03/11 17:44:05 Rhialto + * No more Internal_Update() at CloseDevice() time. + * * Revision 1.4 90/02/10 21:42:17 Rhialto * Small changes ! * * Revision 1.3 90/01/27 20:36:04 Rhialto * Variable #sectors/track! * * Revision 1.1 89/12/17 20:04:11 Rhialto * * DEVIO.C *************** *** 1087,1094 **** unit->mu_NumCyls = TDGetNumCyls(tdreq); unit->mu_UnitNr = UnitNr; unit->mu_DiskState = STATEF_UNKNOWN; - unit->mu_TrackChanged = 0; unit->mu_CurrentSide = -1; unit->mu_InitSectorStatus = CRC_UNCHECKED; unit->mu_SectorsPerTrack = MS_SPT; --- 1087,1094 ---- unit->mu_NumCyls = TDGetNumCyls(tdreq); unit->mu_UnitNr = UnitNr; unit->mu_DiskState = STATEF_UNKNOWN; unit->mu_CurrentSide = -1; + unit->mu_TrackChanged = 0; unit->mu_InitSectorStatus = CRC_UNCHECKED; unit->mu_SectorsPerTrack = MS_SPT; *************** *** 1127,1137 **** DEV *dev; register UNIT *unit; { - #ifndef READONLY - if (ioreq && unit->mu_TrackChanged) - Internal_Update(ioreq, unit); - #endif - /* * Get rid of the Unit's task. We know this is safe because the unit * has an open count of zero, so it is 'guaranteed' not in use. --- 1127,1132 ---- *************** *** 1485,1491 **** debug(("CMD_Format ")); if (CheckRequest(ioreq, unit)) ! goto end; userbuf = (byte *) ioreq->iotd_Req.io_Data; length = ioreq->iotd_Req.io_Length / MS_BPS; /* Sector count */ --- 1480,1486 ---- debug(("CMD_Format ")); if (CheckRequest(ioreq, unit)) ! goto termio; userbuf = (byte *) ioreq->iotd_Req.io_Data; length = ioreq->iotd_Req.io_Length / MS_BPS; /* Sector count */ *************** *** 1492,1500 **** cylinder = ioreq->iotd_Req.io_Offset / MS_BPS; /* Sector number */ /* * Now try to guess the number of sectors the user wants per track. ! * 40 sectors is the first ambuiguous length. */ ! if (length < 40) { if (length > 0) { for (spt = 8; spt <= MS_SPT_MAX; spt++) { if ((length % spt) == 0) --- 1487,1497 ---- cylinder = ioreq->iotd_Req.io_Offset / MS_BPS; /* Sector number */ /* * Now try to guess the number of sectors the user wants per track. ! * 40 sectors is the first ambiguous length. */ ! if (length <= MS_SPT_MAX) ! spt = length; ! else if (length < 40) { if (length > 0) { for (spt = 8; spt <= MS_SPT_MAX; spt++) { if ((length % spt) == 0) *************** *** 1505,1511 **** * Not 8, 16, 24, 32, 9, 18, 27, 36, 10, 20, or 30? That is an error. */ ioreq->iotd_Req.io_Error = IOERR_BADLENGTH; ! goto end; } else /* assume previous number */ spt = unit->mu_SectorsPerTrack; --- 1502,1508 ---- * Not 8, 16, 24, 32, 9, 18, 27, 36, 10, 20, or 30? That is an error. */ ioreq->iotd_Req.io_Error = IOERR_BADLENGTH; ! goto termio; } else /* assume previous number */ spt = unit->mu_SectorsPerTrack; *************** *** 1573,1578 **** --- 1570,1577 ---- } end: unit->mu_CurrentSide = -1; + unit->mu_TrackChanged = 0; + termio: TermIO(ioreq); } /* INDENT OFF */ *************** *** 1817,1834 **** ; requires: a3 = pointer to the unencoded data ; returns: d0 = CRC - DataCRC: - movem.l d1-d3/a3-a5,-(sp) ; save registers - bra.s DataCRC1 - ; C entry point for DataCRC(byte *data) _DataCRC: ! movem.l d1-d3/a3-a5,-(sp) ; save registers fp set (4*(3+3))+4 data set 0 ! move.l fp+data(sp),a3 ; get parameter ! DataCRC1: move.w #$e2,d0 ; preload the CRC registers move.w #$95,d1 ; (CRC for $a1,$a1,$a1,$fe) move.w #MS_BPS-1,d3 ; a sector 512 bytes --- 1816,1828 ---- ; requires: a3 = pointer to the unencoded data ; returns: d0 = CRC ; C entry point for DataCRC(byte *data) _DataCRC: ! movem.l d1-d3/a3-a5,-(sp) ; save registers fp set (4*(3+3))+4 data set 0 ! move.l fp+data(sp),a3 ; get parameter move.w #$e2,d0 ; preload the CRC registers move.w #$95,d1 ; (CRC for $a1,$a1,$a1,$fe) move.w #MS_BPS-1,d3 ; a sector 512 bytes *** t:,RDFt1A14ed8 Sun Mar 11 12:02:45 1990 --- support.c Sun Mar 11 11:45:05 1990 *************** *** 1,9 **** /*- ! * $Id: support.c,v 1.2 90/02/03 17:01:19 Rhialto Rel $ * $Log: support.c,v $ * Revision 1.2 90/02/03 17:01:19 Rhialto * Add error checking in dosalloc() ! * * Revision 1.1 89/12/17 19:57:50 Rhialto * Initial revision * --- 1,12 ---- /*- ! * $Id: support.c,v 1.3 90/03/11 17:44:51 Rhialto Rel $ * $Log: support.c,v $ + * Revision 1.3 90/03/11 17:44:51 Rhialto + * Patch1 + * * Revision 1.2 90/02/03 17:01:19 Rhialto * Add error checking in dosalloc() ! * * Revision 1.1 89/12/17 19:57:50 Rhialto * Initial revision * *************** *** 127,133 **** return (NULL); } ! #ifdef DEBUG char * typetostr(ty) long ty; --- 130,136 ---- return (NULL); } ! #ifdef HDEBUG char * typetostr(ty) long ty; *************** *** 196,199 **** } } ! #endif /* DEBUG */ --- 199,202 ---- } } ! #endif /* HDEBUG */ *** t:,RDFt1A14ed8 Sun Mar 11 12:03:04 1990 --- hanfile.c Sun Mar 11 11:45:26 1990 *************** *** 1,9 **** /*- ! * $Id: hanfile.c,v 1.6 90/02/10 21:38:26 Rhialto Rel $ * $Log: hanfile.c,v $ * Revision 1.6 90/02/10 21:38:26 Rhialto * Optimized 12-bit fat unpacking. ! * * Revision 1.5 90/01/27 20:26:51 Rhialto * Fixed ATTR_ARCHIVED bit in MSWrite() * --- 1,12 ---- /*- ! * $Id: hanfile.c,v 1.7 90/03/11 17:45:06 Rhialto Rel $ * $Log: hanfile.c,v $ + * Revision 1.7 90/03/11 17:45:06 Rhialto + * Patch1 + * * Revision 1.6 90/02/10 21:38:26 Rhialto * Optimized 12-bit fat unpacking. ! * * Revision 1.5 90/01/27 20:26:51 Rhialto * Fixed ATTR_ARCHIVED bit in MSWrite() * *************** *** 29,38 **** * May not be used or copied without a licence. -*/ - #include "han.h" #include "dos.h" ! #ifdef DEBUG # define debug(x) dbprintf x #else # define debug(x) --- 32,41 ---- * May not be used or copied without a licence. -*/ #include "dos.h" + #include "han.h" ! #ifdef HDEBUG # define debug(x) dbprintf x #else # define debug(x) *************** *** 118,127 **** } /* ! * Convert the special values 0xFF0 .. 0xFFF to 16 bits so they * can be checked consistently. */ ! if (twoentries >= 0xFF0) twoentries |= 0xF000; return twoentries; --- 121,130 ---- } /* ! * Convert the special values 0xFF7 .. 0xFFF to 16 bits so they * can be checked consistently. */ ! if (twoentries >= 0xFF7) twoentries |= 0xF000; return twoentries; *************** *** 824,830 **** OtherEndianMsd(&dir[1]); MarkSecDirty(dir); } ! #ifdef DEBUG else debug(("!!! No \"..\" found ??\n")); #endif --- 827,833 ---- OtherEndianMsd(&dir[1]); MarkSecDirty(dir); } ! #ifdef HDEBUG else debug(("!!! No \"..\" found ??\n")); #endif *************** *** 848,854 **** MSUnLock(sfl->msfl_Parent); sfl->msfl_Parent = dfl->msfl_Parent; dfl->msfl_Parent = NULL; ! sfl->msfl_Msd.msd_Attributes &= ~ATTR_ARCHIVED; WriteFileLock(sfl); /* Write the new name; the old name * already has been deleted. */ success = DOSTRUE; --- 851,857 ---- MSUnLock(sfl->msfl_Parent); sfl->msfl_Parent = dfl->msfl_Parent; dfl->msfl_Parent = NULL; ! sfl->msfl_Msd.msd_Attributes |= ATTR_ARCHIVED; WriteFileLock(sfl); /* Write the new name; the old name * already has been deleted. */ success = DOSTRUE; *** t:,RDFt1A14ed8 Sun Mar 11 12:03:28 1990 --- pack.c Sun Mar 11 11:45:54 1990 *************** *** 1,9 **** /*- ! * $Id: pack.c,v 1.3 90/02/03 17:02:05 Rhialto Rel $ * $Log: pack.c,v $ * Revision 1.3 90/02/03 17:02:05 Rhialto * Add error checking wrt dosalloc() ! * * Revision 1.2 89/12/17 23:06:54 Rhialto * Add ACTION_SET_PROTECT * --- 1,12 ---- /*- ! * $Id: pack.c,v 1.4 90/03/11 17:45:27 Rhialto Rel $ * $Log: pack.c,v $ + * Revision 1.4 90/03/11 17:45:27 Rhialto + * Use Reserved from Mountlist + * * Revision 1.3 90/02/03 17:02:05 Rhialto * Add error checking wrt dosalloc() ! * * Revision 1.2 89/12/17 23:06:54 Rhialto * Add ACTION_SET_PROTECT * *************** *** 37,43 **** #include "dos.h" #include "han.h" ! #ifdef DEBUG # define debug(x) dbprintf x #else # define debug(x) --- 40,46 ---- #include "dos.h" #include "han.h" ! #ifdef HDEBUG # define debug(x) dbprintf x #else # define debug(x) *************** *** 97,103 **** SysBase = AbsExecBase; DOSBase = OpenLibrary("dos.library", 0L); ! #ifdef DEBUG /* * Initialize debugging code as soon as possible. Only SysBase and * DOSBase are required. --- 100,106 ---- SysBase = AbsExecBase; DOSBase = OpenLibrary("dos.library", 0L); ! #ifdef HDEBUG /* * Initialize debugging code as soon as possible. Only SysBase and * DOSBase are required. *************** *** 104,110 **** */ dbinit(); ! #endif /* DEBUG */ DosPort = &((struct Process *)FindTask(NULL))->pr_MsgPort; --- 107,113 ---- */ dbinit(); ! #endif /* HDEBUG */ DosPort = &((struct Process *)FindTask(NULL))->pr_MsgPort; *************** *** 117,122 **** --- 120,126 ---- { struct FileSysStartupMsg *fssm; ulong *environ; + ulong Reserved; DevName = "messydisk.device"; UnitNr = 0; *************** *** 128,133 **** --- 132,138 ---- Disk.spt = MS_SPT; Disk.bps = MS_BPS; Disk.lowcyl = 0; + Reserved = 0; if (fssm = (struct FileSysStartupMsg *)BTOC(DevNode->dn_Startup)) { /* Same as BTOC(packet->dp_Arg2) */ *************** *** 138,144 **** if (environ = BTOC(fssm->fssm_Environ)) { debug(("environ size %ld\n", environ[0])); ! #define get(xx,yy) if (environ[0] >= yy) xx = environ[yy]; get(MaxCache, DE_NUMBUFFERS); get(BufMemType, DE_MEMBUFTYPE); --- 143,149 ---- if (environ = BTOC(fssm->fssm_Environ)) { debug(("environ size %ld\n", environ[0])); ! #define get(xx,yy) if (environ[DE_TABLESIZE] >= yy) xx = environ[yy]; get(MaxCache, DE_NUMBUFFERS); get(BufMemType, DE_MEMBUFTYPE); *************** *** 148,157 **** --- 153,164 ---- Disk.bps *= 4; debug(("Disk.bps %d\n", Disk.bps)); get(Disk.lowcyl, DE_LOWCYL); + get(Reserved, DE_RESERVEDBLKS); #undef get } } Disk.lowcyl *= (long)MS_BPS * Disk.spt * Disk.nsides; + Disk.lowcyl += (long)MS_BPS * Reserved; } if (DOSBase && HanOpenUp()) { *************** *** 507,513 **** debug(("ERR=%d\n", error)); PRes2 = error; } ! #ifdef DEBUG else { debug(("RES=%06lx\n", PRes1)); } --- 514,520 ---- debug(("ERR=%d\n", error)); PRes2 = error; } ! #ifdef HDEBUG else { debug(("RES=%06lx\n", PRes1)); } *************** *** 515,521 **** returnpacket(packet); DosPacket = NULL; } ! #ifdef DEBUG else { debug(("NOREP\n")); } --- 522,528 ---- returnpacket(packet); DosPacket = NULL; } ! #ifdef HDEBUG else { debug(("NOREP\n")); } *************** *** 536,545 **** } } /* end for (;notdone) */ ! #ifdef DEBUG debug(("Can we remove ourselves? ")); Delay(50L); /* I wanna even see the debug message! */ ! #endif /* DEBUG */ Forbid(); if (OpenCount || packetsqueued()) { Permit(); --- 543,552 ---- } } /* end for (;notdone) */ ! #ifdef HDEBUG debug(("Can we remove ourselves? ")); Delay(50L); /* I wanna even see the debug message! */ ! #endif /* HDEBUG */ Forbid(); if (OpenCount || packetsqueued()) { Permit(); *************** *** 562,571 **** * Remove debug window, closedown, fall of the end of the world. */ exit: ! #ifdef DEBUG Delay(100L); /* This is dangerous! */ dbuninit(); ! #endif /* DEBUG */ #if 1 UnLoadSeg(DevNode->dn_SegList); /* This is real fun. We are still */ --- 569,578 ---- * Remove debug window, closedown, fall of the end of the world. */ exit: ! #ifdef HDEBUG Delay(100L); /* This is dangerous! */ dbuninit(); ! #endif /* HDEBUG */ #if 1 UnLoadSeg(DevNode->dn_SegList); /* This is real fun. We are still */ *************** *** 772,782 **** dosfree(BTOC(dl->dl_Name)); dosfree(dl); } ! #ifdef DEBUG else { debug(("****PANIC: Unable to find volume node\n")); } ! #endif /* DEBUG */ Permit(); if (volnode == VolNode) --- 779,789 ---- dosfree(BTOC(dl->dl_Name)); dosfree(dl); } ! #ifdef HDEBUG else { debug(("****PANIC: Unable to find volume node\n")); } ! #endif /* HDEBUG */ Permit(); if (volnode == VolNode) *************** *** 920,926 **** return error; } ! #ifdef DEBUG /* DEBUGGING */ PORT *Dbport; /* owned by the debug process */ PORT *Dback; /* owned by the DOS device driver */ --- 927,933 ---- return error; } ! #ifdef HDEBUG /* DEBUGGING */ PORT *Dbport; /* owned by the debug process */ PORT *Dback; /* owned by the DOS device driver */ *************** *** 1052,1055 **** rts #endasm ! #endif /* DEBUG */ --- 1059,1062 ---- rts #endasm ! #endif /* HDEBUG */ *** t:,RDFt1A14ed8 Sun Mar 11 12:03:50 1990 --- dos.h Sun Mar 11 11:46:07 1990 *************** *** 1,15 **** /* ! * $Id: dos.h,v 1.2 90/01/27 20:29:53 Rhialto Rel $ */ ! #ifdef NOTDEF #include "exec/types.h" #include "exec/memory.h" #include "libraries/dos.h" #include "libraries/dosextens.h" #include "libraries/filehandler.h" ! #endif NOTDEF /* * ACTIONS which do not exist in dosextens.h but which indeed exist on --- 1,41 ---- /* ! * $Id: dos.h,v 1.3 90/03/11 17:45:55 Rhialto Rel $ */ ! #ifndef EXEC_TYPES_H #include "exec/types.h" + #endif + #ifndef EXEC_MEMORY_H #include "exec/memory.h" + #endif + #ifndef EXEC_INTERRUPTS_H + #include "exec/interrupts.h" + #endif + #ifndef EXEC_NODES_H + #include "exec/nodes.h" + #endif + #ifndef EXEC_PORTS_H + #include "exec/ports.h" + #endif + #ifndef EXEC_IO_H + #include "exec/io.h" + #endif + #ifndef LIBRARIES_DOS_H #include "libraries/dos.h" + #endif + #ifndef LIBRARIES_DOSEXTENS_H #include "libraries/dosextens.h" + #endif + #ifndef LIBRARIES_FILEHANDLER_H #include "libraries/filehandler.h" ! #endif ! #ifndef DEVICES_TRACKDISK_H ! #include "devices/trackdisk.h" ! #endif ! #ifndef DEVICES_TIMER_H ! #include "devices/timer.h" ! #endif /* * ACTIONS which do not exist in dosextens.h but which indeed exist on *** t:,RDFt1A14ed8 Sun Mar 11 12:04:06 1990 --- hanreq.c Sun Mar 11 11:46:18 1990 *************** *** 1,9 **** /*- ! * $Id: hanreq.c,v 1.1 89/12/17 20:03:24 Rhialto Rel $ * $Log: hanreq.c,v $ * Revision 1.1 89/12/17 20:03:24 Rhialto * Initial revision - * * * HANREQ.C * --- 1,11 ---- /*- ! * $Id: hanreq.c,v 1.2 90/03/11 17:46:08 Rhialto Rel $ * $Log: hanreq.c,v $ + * Revision 1.2 90/03/11 17:46:08 Rhialto + * Patch1 + * * Revision 1.1 89/12/17 20:03:24 Rhialto * Initial revision * * HANREQ.C * *************** *** 16,26 **** -*/ #include "dos.h" - #include - #include #include ! #ifdef DEBUG # define debug(x) dbprintf x #else # define debug(x) --- 18,26 ---- -*/ #include "dos.h" #include ! #ifdef HDEBUG # define debug(x) dbprintf x #else # define debug(x) *************** *** 119,133 **** if (VolNode) text[1].IText = (UBYTE *)BTOC(VolNode->dl_Name)+1; else ! text[1].IText = NULL; again: result = AutoRequest(window, text, &Positive, &Negative, ! 0L, 0L, 320L, 72L); if (req->iotd_Req.io_Error == TDERR_DiskChanged && result != FALSE) { - if (DiskChanged == 0) /* Cheating, huh ? */ - goto again; TDChangeNum(); /* Get new disk change number */ DiskChanged = 0; } --- 119,131 ---- if (VolNode) text[1].IText = (UBYTE *)BTOC(VolNode->dl_Name)+1; else ! text[1].IText = (UBYTE *)""; again: result = AutoRequest(window, text, &Positive, &Negative, ! 0L, 0L, 320L, 72L); if (req->iotd_Req.io_Error == TDERR_DiskChanged && result != FALSE) { TDChangeNum(); /* Get new disk change number */ DiskChanged = 0; } *** t:,RDFt1A14ed8 Sun Mar 11 12:04:25 1990 --- hanlock.c Sun Mar 11 11:46:46 1990 *************** *** 1,9 **** /*- ! * $Id: hanlock.c,v 1.4 90/01/27 20:22:17 Rhialto Rel $ * $Log: hanlock.c,v $ * Revision 1.4 90/01/27 20:22:17 Rhialto * Added extra check when freeing MSFileLocks. ! * * Revision 1.3 90/01/23 00:36:57 Rhialto * Add an #ifndef READONLY. * --- 1,12 ---- /*- ! * $Id: hanlock.c,v 1.5 90/03/11 17:46:19 Rhialto Rel $ * $Log: hanlock.c,v $ + * Revision 1.5 90/03/11 17:46:19 Rhialto + * Examine on RootLock fixed + * * Revision 1.4 90/01/27 20:22:17 Rhialto * Added extra check when freeing MSFileLocks. ! * * Revision 1.3 90/01/23 00:36:57 Rhialto * Add an #ifndef READONLY. * *************** *** 23,32 **** * not be used or copied without a licence. -*/ - #include "han.h" #include "dos.h" ! #ifdef DEBUG # define debug(x) dbprintf x #else # define debug(x) --- 26,35 ---- * not be used or copied without a licence. -*/ #include "dos.h" + #include "han.h" ! #ifdef HDEBUG # define debug(x) dbprintf x #else # define debug(x) *************** *** 45,55 **** ATTR_VOLUMELABEL, /* msd_Attributes */ {0}, /* msd_Pad1 */ 0, /* msd_Time */ ! 0x21, /* msd_Date, 1/1/80 */ 0, /* msd_Cluster */ 0 /* msd_Filesize */ }, ! -1, /* de_Sector */ 0 /* de_Offset */ }; byte DotDot[1 + 8 + 3] = ".. "; --- 48,58 ---- ATTR_VOLUMELABEL, /* msd_Attributes */ {0}, /* msd_Pad1 */ 0, /* msd_Time */ ! DATE_MIN, /* msd_Date, 1/1/80 */ 0, /* msd_Cluster */ 0 /* msd_Filesize */ }, ! ROOT_SEC, /* de_Sector */ 0 /* de_Offset */ }; byte DotDot[1 + 8 + 3] = ".. "; *************** *** 63,78 **** register struct MsDirEntry *dir; register byte *name; { - #ifdef DEBUG - if (name[0] == '\\') { - extern short DBEnable; - - DBEnable = name[1] & 0x0F; - - return CMP_END_OF_DIR; - } - #endif - if (dir->msd_Name[0] & DIR_DELETED_MASK) return CMP_FREE_SLOT; --- 66,71 ---- *************** *** 157,163 **** return NULL; } ! #ifdef DEBUG void PrintDirEntry(de) --- 150,156 ---- return NULL; } ! #ifdef HDEBUG void PrintDirEntry(de) *************** *** 196,202 **** if (mode != EXCLUSIVE_LOCK || (dir->de_Msd.msd_Attributes & ATTR_DIR)) mode = SHARED_LOCK; ! #ifdef DEBUG debug(("MakeLock: ")); PrintDirEntry(dir); #endif --- 189,195 ---- if (mode != EXCLUSIVE_LOCK || (dir->de_Msd.msd_Attributes & ATTR_DIR)) mode = SHARED_LOCK; ! #ifdef HDEBUG debug(("MakeLock: ")); PrintDirEntry(dir); #endif *************** *** 211,217 **** for (fl = (struct MSFileLock *) LockList->ll_List.mlh_Head; nextfl = (struct MSFileLock *) fl->msfl_Node.mln_Succ; fl = nextfl) { ! #ifdef DEBUG debug(("> ")); PrintDirEntry(&fl->msfl_Msd); #endif --- 204,210 ---- for (fl = (struct MSFileLock *) LockList->ll_List.mlh_Head; nextfl = (struct MSFileLock *) fl->msfl_Node.mln_Succ; fl = nextfl) { ! #ifdef HDEBUG debug(("> ")); PrintDirEntry(&fl->msfl_Msd); #endif *************** *** 279,285 **** /* * See if we have an absolute path name (starting at the root). */ - { register byte *colon; --- 272,277 ---- *************** *** 286,294 **** --- 278,296 ---- if (colon = index(name, ':')) { name = colon + 1; parentdir = RootLock; + /* + * MSH::Command or ::Command? + */ + if (name[0] == ':') { + HandleCommand(name); + error = ERROR_OBJECT_NOT_FOUND; + + return NULL; + } } } + /* * Get a copy of the parent dir lock, so we can walk it over the * directory tree. *************** *** 302,308 **** sde.de_Msd = parentdir->msfl_Msd; sde.de_Sector = parentdir->msfl_DirSector; sde.de_Offset = parentdir->msfl_DirOffset; ! #ifdef DEBUG debug(("pdir %08lx: ", parentdir)); PrintDirEntry(&parentdir->msfl_Msd); #endif --- 304,310 ---- sde.de_Msd = parentdir->msfl_Msd; sde.de_Sector = parentdir->msfl_DirSector; sde.de_Offset = parentdir->msfl_DirOffset; ! #ifdef HDEBUG debug(("pdir %08lx: ", parentdir)); PrintDirEntry(&parentdir->msfl_Msd); #endif *************** *** 476,482 **** MSUnLock(fl) struct MSFileLock *fl; { ! #ifdef DEBUG debug(("MSUnLock %08lx: ", fl)); PrintDirEntry(&fl->msfl_Msd); #endif --- 478,484 ---- MSUnLock(fl) struct MSFileLock *fl; { ! #ifdef HDEBUG debug(("MSUnLock %08lx: ", fl)); PrintDirEntry(&fl->msfl_Msd); #endif *************** *** 524,547 **** struct MsDirEntry *msd; register struct FileInfoBlock *fib; { ! register byte *end, ! *dot; ! ! #ifdef DEBUG debug(("+ ")); PrintDirEntry(msd); #endif ! strncpy(&fib->fib_FileName[1], msd->msd_Name, 8); ! /* Keep at least one character, even a space, before the dot */ ! dot = ZapSpaces(&fib->fib_FileName[2], &fib->fib_FileName[1 + 8]); ! dot[0] = ' '; ! strncpy(dot + 1, msd->msd_Ext, 3); ! dot[4] = '\0'; ! end = ZapSpaces(dot, dot + 4); ! if (end > dot) ! dot[0] = '.'; fib->fib_FileName[0] = strlen(&fib->fib_FileName[1]); fib->fib_DirEntryType = (msd->msd_Attributes & ATTR_DIR) ? FILE_DIR : FILE_FILE; fib->fib_Protection = 0; --- 526,558 ---- struct MsDirEntry *msd; register struct FileInfoBlock *fib; { ! #ifdef HDEBUG debug(("+ ")); PrintDirEntry(msd); #endif ! /* ! * Special treatment when we examine the root directory ! */ ! if (fib->fib_DiskKey == (long)ROOT_SEC << 16) { ! strncpy(&fib->fib_FileName[1], msd->msd_Name, 8 + 3); ! (void) ZapSpaces(&fib->fib_FileName[2], &fib->fib_FileName[1 + 8 + 3]); ! } else { ! register byte *end, ! *dot; ! ! strncpy(&fib->fib_FileName[1], msd->msd_Name, 8); ! /* Keep at least one character, even a space, before the dot */ ! dot = ZapSpaces(&fib->fib_FileName[2], &fib->fib_FileName[1 + 8]); ! dot[0] = ' '; ! strncpy(dot + 1, msd->msd_Ext, 3); ! dot[4] = '\0'; ! end = ZapSpaces(dot, dot + 4); ! if (end > dot) ! dot[0] = '.'; ! } fib->fib_FileName[0] = strlen(&fib->fib_FileName[1]); + fib->fib_EntryType = fib->fib_DirEntryType = (msd->msd_Attributes & ATTR_DIR) ? FILE_DIR : FILE_FILE; fib->fib_Protection = 0; *************** *** 557,562 **** --- 568,582 ---- fib->fib_Comment[0] = 0; } + /* + * We remember what we should do when we call ExNext with a lock on + * a directory (enter or step over it) by a flag in fib_EntryType. + * Unfortunately, the Commodore (1.3) List and Dir commands expect + * that fib_EntryType contains the information that the documentation + * (libraries/dos.h) specifies to be in fib_DirEntrType. Therefore + * we use the low bit in fib_DirEntryType instead. + */ + int MSExamine(fl, fib) struct MSFileLock *fl; *************** *** 566,573 **** fl = RootLock; fib->fib_DiskKey = ((ulong) fl->msfl_DirSector << 16) | fl->msfl_DirOffset; - fib->fib_EntryType = 0; /* No ExNext called yet */ ExamineDirEntry(&fl->msfl_Msd, fib); return DOSTRUE; } --- 586,593 ---- fl = RootLock; fib->fib_DiskKey = ((ulong) fl->msfl_DirSector << 16) | fl->msfl_DirOffset; ExamineDirEntry(&fl->msfl_Msd, fib); + /* No ExNext called yet */ return DOSTRUE; } *************** *** 584,591 **** if (fl == NULL) fl = RootLock; ! if (fib->fib_EntryType == 0) { ! fib->fib_EntryType = 1; if (fl->msfl_Msd.msd_Attributes & ATTR_DIR) { /* Enter subdirectory */ sector = DirClusterToSector(fl->msfl_Msd.msd_Cluster); --- 604,610 ---- if (fl == NULL) fl = RootLock; ! if (!(fib->fib_DirEntryType & 1)) { if (fl->msfl_Msd.msd_Attributes & ATTR_DIR) { /* Enter subdirectory */ sector = DirClusterToSector(fl->msfl_Msd.msd_Cluster); *************** *** 598,621 **** } if (sector != SEC_EOF) { ! register struct MsDirEntry *msd; if (buf = GetSec(sector)) { ! msd = (struct MsDirEntry *) (buf + offset); ! if (msd->msd_Name[0] == '\0') { FreeSec(buf); goto end; } ! if (msd->msd_Name[0] & DIR_DELETED_MASK || ! msd->msd_Name[0] == '.' || /* Hide "." and ".." */ ! (msd->msd_Attributes & ATTR_VOLUMELABEL)) { FreeSec(buf); goto skip; } ! OtherEndianMsd(msd);/* Get correct endianness */ fib->fib_DiskKey = ((ulong) sector << 16) | offset; ! ExamineDirEntry(msd, fib); ! OtherEndianMsd(msd);/* Get wrong endianness */ FreeSec(buf); return DOSTRUE; --- 617,640 ---- } if (sector != SEC_EOF) { ! struct MsDirEntry msd; if (buf = GetSec(sector)) { ! msd = *(struct MsDirEntry *) (buf + offset); ! if (msd.msd_Name[0] == '\0') { FreeSec(buf); goto end; } ! if (msd.msd_Name[0] & DIR_DELETED_MASK || ! msd.msd_Name[0] == '.' || /* Hide "." and ".." */ ! (msd.msd_Attributes & ATTR_VOLUMELABEL)) { FreeSec(buf); goto skip; } ! OtherEndianMsd(&msd); /* Get correct endianness */ fib->fib_DiskKey = ((ulong) sector << 16) | offset; ! ExamineDirEntry(&msd, fib); ! fib->fib_DirEntryType++; /* Make it odd */ FreeSec(buf); return DOSTRUE; *** t:,RDFt1A14ed8 Sun Mar 11 12:04:46 1990 --- dev.h Sun Mar 11 11:46:57 1990 *************** *** 1,8 **** /*- ! * $Id: dev.h,v 1.2 90/01/27 20:38:18 Rhialto Rel $ * * Include file for users of the messydisk.device -*/ typedef unsigned char byte; typedef unsigned short word; --- 1,60 ---- /*- ! * $Id: dev.h,v 1.3 90/03/11 17:46:47 Rhialto Rel $ * * Include file for users of the messydisk.device -*/ + + #ifndef EXEC_TYPES_H + #include "exec/types.h" + #endif + #ifndef EXEC_MEMORY_H + #include "exec/memory.h" + #endif + #ifndef EXEC_SEMAPHORES_H + #include "exec/semaphores.h" + #endif + #ifndef EXEC_INTERRUPTS_H + #include "exec/interrupts.h" + #endif + #ifndef EXEC_NODES_H + #include "exec/nodes.h" + #endif + #ifndef EXEC_PORTS_H + #include "exec/ports.h" + #endif + #ifndef EXEC_IO_H + #include "exec/io.h" + #endif + #ifndef EXEC_ERRORS_H + #include "exec/errors.h" + #endif + #ifndef EXEC_DEVICES_H + #include "exec/devices.h" + #endif + #ifndef RESOURCES_DISK_H + #include "resources/disk.h" + #endif + #ifndef RESOURCES_CIA_H + #include "resources/cia.h" + #endif + #ifndef HARDWARE_CUSTOM_H + #include "hardware/custom.h" + #endif + #ifndef HARDWARE_CIA_H + #include "hardware/cia.h" + #endif + #ifndef HARDWARE_ADKBITS_H + #include "hardware/adkbits.h" + #endif + #ifndef HARDWARE_DMABITS_H + #include "hardware/dmabits.h" + #endif + #ifndef HARDWARE_INTBITS_H + #include "hardware/intbits.h" + #endif + #ifndef DEVICES_TRACKDISK_H + #include "devices/trackdisk.h" + #endif typedef unsigned char byte; typedef unsigned short word; *** t:,RDFt1A14ed8 Sun Mar 11 12:05:03 1990 --- han.h Sun Mar 11 11:47:10 1990 *************** *** 1,5 **** /*- ! * $Id: han.h,v 1.4 90/01/27 20:33:22 Rhialto Rel $ * * The header file for the MESSYDOS: file system handler * --- 1,5 ---- /*- ! * $Id: han.h,v 1.5 90/03/11 17:46:58 Rhialto Rel $ * * The header file for the MESSYDOS: file system handler * *************** *** 9,18 **** #define MODE_READWRITE 1004L #define MODE_CREATEFILE (1L<<31) ! #define FILE_DIR 1 ! #define FILE_FILE -1 - /* #define MS_BPS 512 /* Bytes per sector */ #define MS_SPC 2 /* Sectors per cluster */ #define MS_RES 1 /* Reserved sectors (boot block) */ --- 9,17 ---- #define MODE_READWRITE 1004L #define MODE_CREATEFILE (1L<<31) ! #define FILE_DIR 2 /* Must be even and > 0 */ ! #define FILE_FILE -2 /* Must be even and < -1 */ /* #define MS_BPS 512 /* Bytes per sector */ #define MS_SPC 2 /* Sectors per cluster */ #define MS_RES 1 /* Reserved sectors (boot block) */ *************** *** 31,36 **** --- 30,36 ---- #define FAT_EOF 0xFFFF /* end of file FAT entry */ #define FAT_UNUSED 0 /* unused block */ #define SEC_EOF -1 /* end of FAT chain */ + #define ROOT_SEC -1 /* where the root directory 'is' */ #define DIR_DELETED 0xE5 #define DIR_DELETED_MASK 0x80 *************** *** 285,290 **** --- 285,295 ---- extern long MSDeleteFile(); extern long MSSetDate(); extern struct MSFileLock *MSCreateDir(); + + /* + * HANCMD.C + */ + extern void HandleCommand(); /* * DATE.C *** t:,RDFt1A14ed8 Sun Mar 11 12:05:19 1990 --- date.c Sun Mar 11 11:47:24 1990 *************** *** 1,6 **** /*- ! * $Id: date.c,v 1.2 90/02/03 17:00:25 Rhialto Rel $ * $Log: date.c,v $ * Revision 1.2 90/02/03 17:00:25 Rhialto * 0x21 -> DATE_MIN * --- 1,9 ---- /*- ! * $Id: date.c,v 1.3 90/03/11 17:47:11 Rhialto Rel $ * $Log: date.c,v $ + * Revision 1.3 90/03/11 17:47:11 Rhialto + * No change. + * * Revision 1.2 90/02/03 17:00:25 Rhialto * 0x21 -> DATE_MIN *