
                     A Reference Guide to DU
                         (Disk Utility)

Aî  "Impatienô User'ó Guide¢ tï DÕ (Disë Utility)¬  á famouó disë 
fixer from the public domain libraries.

Prepareä  foò Thå User'ó Guidå Magazine¬  Vol.1¬  No.´ Junå  198³ 
(pageó  53-63© bù Kellù Smitè (TUÇ Contributinç Editor© froí  thå 
originaì prograí anä documentatioî bù Warä Christensen¬  prolifiã 
contributoò tï thå worlä oæ publiã domaiî CP/Í software.

Foò morå informatioî oî thió articlå anä otheró likå it¬  contacô 
Thå User'ó Guidå tï CP/Í Systemó ¦ Software¬  Boø 3050¬ Stanford¬ 
VÁ 94305¬ (415© 851-7352®  TUÇ ió publisheä everù twï months¬ $1¸ 
US, $24 outside US (add $10 for first class delivery anywhere).

                          Introduction

DÕ  ió á comprehensivå "disë diddler¢ utilitù thaô allowó á  useò 
tï  examinå  anä modifù ANÙ portioî oæ á CP/M-8° (Versioî 2.°  oò 
greater© disë aô thå "bytå level"®  Aî "On-Linå Help¢ facilitù ió 
includeä  (jusô presó thå '?§ keù followeä bù RETURN© shoulä  yoõ 
forgeô  thå  extensivå  commanä seô  (typicallù  singlå  keyboarä 
entries¬ terminateä witè á RETURÎ key)® 

Á  worä  oæ cautioî tï thå novicå user...iô ió possiblå tï  DÕ  á 
disë tï death¡   Thaô is¬  casuaì modificatioî oæ portionó oæ thå 
CP/M-8°  operatinç  systeí datá trackó ió usuallù destructivå  tï 
thå propeò operatioî oæ thå "copy¢ oæ CP/Í oî thå modifieä  disk®  

Use particular care when writing your modifications back to disk!

DÕ  ió  aî invaluablå tooì foò recoverù oæ "bombeä  directories"¬ 
modificatioî  oæ  CP/Í "ruî time¢ parameters¬  oò eveî  makinç  á 
"backup¢  oæ youò disë directorù anä preservinç iô someplacå  "iî 
reserve¢ oî youò disk...thå possibilitieó arå NOÔ LIMITEÄ bù DU!

Thå  besô parô ió thaô iô waó provideä FREÅ tï thå publiã  domaiî 
(maù bå freelù useä anä giveî away© bù Warä Christensen¬ anä eveî 
includeó  sourcå  codå  foò  youò  detaileä  examinatioî   and/oò 
customizatioî (wheî customizinç publiã domaiî software¬ youò "on-
your-own¢ however...don'ô expecô "hand-holding¢ froí thå originaì 
authoò wheî yoõ "writå oî theiò wall"!).

Sï  beforå yoõ gï ouô anä BUÙ á functionallù  identicaì  softwarå 
packagå (Gads¡  É woulä lovå tï namå names!!!)¬ takå á looë aô DÕ 
first.  You wont't find a better program for the money!
 
Thanë yoõ agaiî Ward¬  foò yeô anotheò majoò contributioî tï  thå 
CP/Í  softwarå useò community¡   Sï withouô furtheò ado¬  herå ió 
youò User'ó Guidå tï DÕ (poetic!):


                              IndexŠ
1.0 Installation.

2.0 Usage.

     2.1 Commands, by Function (Quick Reference).

     2.2 Alphabetic Command Summary.

3.0 Usage Notes.

     3.1 Multiple Commands.

     3.² Dumð Commandó.

     3.³ Logginç iî Disk.

     3.´ Sectoò Bufferó.

4.0 Interpreting CP/M Directory Data.

     4.1 Single Density.

     4.2 Double Density.

5.0 DU Usage Examples

     5.1 Erased Program Recovery

     5.2 Modifying a Disk for "Program Autoload"

     5.3 Finding and Modifying Program Data Quickly

     5.4 A "Poor Man's" Disk Test


1.0 Installation

DÕ  (Disë Utility)¬  Versionó 7.° anä later¬  arå designeä tï  bå 
installeä  witè  á minimuí oæ trouble®   Iî fact¬  iî almosô  alì 
cases¬  nï changeó tï thå sourcå filå shoulä bå necessarù tï  geô 
DÕ "uð anä running"®   Yes¡  808° sourcå codå ió availablå iæ yoõ 
wanô  iô froí variouó RCPÍ systemó aó welì aó directleù froí  thå 
CP/Í  User'ó Grouð librarù (oò yoõ maù contacô thå CPMUÇ carå ofº 
Lifeboaô Associates¬ 165± Thirä Avenue¬ Ne÷ York® N.Y® 10028)®  

Thå onlù requiremenô foò usagå oæ DU¬ ió thaô yoõ musô bå runninç 
iî  á CP/M-8° Operatinç Systeí environmenô oæ "vintage¢  2.°  (oò 
greater)®  Thió  ió  becauså  DÕ useó thå  disë  parameteò  blocë 
incorporateä iî thå latesô releaseó oæ Digitaì Research'ó CP/M-8° 
tï  determinå thå characteristicó oæ thå disë  environment®  Notå 
also¬  thaô  earlieò versionó oæ DÕ supporteä onlù thå standarä ¸ 
incè  "distributioî  standard¢ IBÍ 374°  typå  diskette¬  runninç 
CP/M-8°  versioî 1.´ anä iî somå caseó diä noô worë  foò  certaiî 
"non-standard¢ versionó oæ CP/M-8° (i.e.¬ CDOÓ froí Cromemco¬ anä Šsome implementations of CP/M-80 from Lifeboat Associates). 

Thå onlù parameteò thaô yoõ mighô neeä tï change¬ wilì bå thå CPÕ 
clocë  speeä flaç aô addresó 103È (wheî DÕ ió loadeä intï  systeí 
memory)®   Leavå  thió  bytå  zerï iæ yoõ havå  á  ²  MHú  clock®  
"Patch¢  iô  non-zerï (changå thå addresó contenô tï 0FFH© foò  ´ 
MHú (refeò tï youò Digitaì Researcè DDÔ (Dynamiã Debugginç  Tool© 
documentatioî  iæ yoõ arå unfamilieò witè modificatioî oæ prograí 
files¬  anä "patching¢ techniques)®   Thió ió onlù needeä foò thå 
"Z¢  (sleep©  command®   Aî  alternativå ió jusô  tï  uså  largeò 
numberó wheî runninç DÕ witè á computeò systeí clocë ratå oæ 4MHú 
oò greater.


2.0 Usage

Aî  initiaì commanä strinç maù optionallù bå placeä aó aî operanä 
oæ thå DÕ command at the CP/M system user command level¬ i.e.:

                A>DU G0;D;G2;=OK<D><A><1A>;D<cr>

Foò  example¬  iæ yoõ wanô tï onlù 'MAP§ thå disë anä theî  exit¬ 
you would enter at your console keyboard:

                          A>DU M;X<cr>

Thå  DÕ  prograí  woulä  theî responä  witè  thå  diskettå  'MAP§ 
(actuallù á displaù oæ thå diskettå Grouð Allocations)¬  aó showî 
iî  thå  followinç  examplå  'MAP§  oæ  á  Compuprï  8/1¶  Systeí 
diskette:

DISK UTILITY ver 7.7
Universal Version

Type ? for help
Type X to exit
0004-0005  00 COPY    .COM 00 : 0006-000D  00 WS      .COM 00 
000E-0010  00 DDT     .COM 00 : 0011-0018  00 FMTMEM  .COM 00 
0019-001A  00 FORMAT  .COM 00 : 001B-001B  00 CONV    .COM 00 
001C-001C  00 CRCK    .COM 00 : 001D-001D  00 CROSSREF.COM 00 
001E-001E  00 D       .COM 00 : 001F-0021  00 DU      .TXT 00 
0022-0025  00 PIP     .COM 00 : 0026-0026  00 XDIR    .COM 00 
0027-0027  00 FILE-XT2.COM 00 : 0028-002E  00 RMAC    .COM 00 
002F-0033  00 LINK    .COM 00 : 0034-0034  00 EXEC    .COM 00 
0035-0035  00 SYSGEN  .COM 00 : 0036-0036  00 FMAP    .COM 00 
~                                                           ~
|  The  diskette 'MAP' shown here is "edited" for brevity!  |
~                                                           ~
| .-- Group Allocation Number                               |
~ |           .-- Filename                                  ~
| |           |        .-- Filetype                         |
~ |           |        |    .-- Extent Number               ~
| |           |        |    |               .-- User Number |
~ |           |        |    |               |               ~
020F-020F  00 PBIOS   .ASM 03 : 0210-0216  01 ALIENS  .COM 00 Š0217-0218  00 PBIOS   .ASM 03 : 0219-0219  00 MOVCPM  .COM 00 
021A-021A  00 MNTR    .DOC 00 : 021B-021C  00 PRNT    .DOC 00 
021D-0220  00 REQ'D-SW.DOC 00 : 0221-0228  00 SW-DEF  .TXT 00 
0229-0230  00 SW-DEF  .TXT 01 : 0231-0238  00 SW-DEF  .TXT 02 
0239-023E  00 MOVCPM  .COM 00 : 023F-0241  00 FORMAT  .ASM 00 
0242-0242  00 FORMAT  .ASM 01 : 0243-0247     ++FREE++        
0248-024B  00 PBIOS   .ASM 04 : 024C-0253  00 SETATR  .ASM 00 
0254-0254  00 PBIOS   .ASM 04 : 0255-0257     ++FREE++        

G=0000:00, T=4, S=1, PS=0

A>


Oncå  DÕ  ió running¬  iô wilì displaù thå characteò ':§  aó  thå 
commanä  leveì prompt¬  anä expectó single-letteò  commandó  mucè 
likå  DDT®   Foò easå oæ use¬  multiplå commandó maù bå placeä oî 
onå  line¬  separateä bù ';'®   Iî addition¬  á giveî commanä  oò 
strinç  oæ commandó maù bå repeated¬  eitheò indefinitelù  (untiì 
Control-Ã  (showî froí no÷ oî aó '^C'© ió pressed)¬  oò  á  giveî 
numbeò oæ times.

Tï  avoiä  aî  accidentaì ^Ã froí droppinç ouô  oæ  DU¬  onlù  aî 
expliciô 'X§ commanä wilì exiô DU.


2.1 Commands, by Function (Quick Reference)

Help: 
	?	Request help. Example:

                :?<cr>
                Operands in brackets [...] are optional
                Numeric values: 'n' are decimal, 'x' hex

                +[n]   step in [n] sectors;
                -[n]   step out [n] sectors
                #      print disk parameters for curr drive.
                =xxx   search for ASCII xxx from curr sector.
                       Caution: upper/lower case matters.
                       Use <xx> for hex:
                       To find "IN 0" use: =<db><0>     or
                       "(tab)H,0(CR)(LF)" use: =<9>H,0<D><A>
                <      save current sector into mem. buff.
                >      restore saved sector
                ?      give help
                A[ff,tt] ASCII dump

                (Type any char. to continue)<cr>

                C      Change:
                CHaddr,byte,byte... (hex)
                or   CAaddr,data...  (Ascii)
                <xx> Allowed for imbedded hex.
                or   CHfrom-thru,byte  e.g. ch0-7f,e5Š                or   CAfrom-thru,byte
                D[ff,tt] Dump (hex+ASCII)
                Fn.t   Find file
                Gnn    CP/M Allocation Group nn
                H[ff,tt]       hex dump
                L      Log in drive
                Lx     Log in drive x
                M[nn]  Map [from group nn]

                (Type any char. to continue)<cr>

                N      New disk
                P      Toggle printer switch
                Q      Quiet mode (no msgs)
                R      Read current sector
                Snn    Sector nn
                Tnn    Track nn
                Unn    Set User nn for Find command (CP/M-2 only)
                V[nn]  View [nn] ASCII sectors
                W      Write current sector
                X      Exit program
                Y      Yank current sector into sequential memory
                Z[nn]  Sleep [nn tenths]
                /[nn]  Repeat [nn (decimal) times]

                (Type any char. to continue)<cr>

                Cancel a function with C or Ctl-C.
                Suspend output with S or Ctl-S.
                Separate commands with ";".
                       Example: g0
                       +;d;z#20;/
                       would step in, dump, sleep 2 sec, 
                       and repeat until control-c typed.
                All "nn" usage except "/", "T", and "S" are
                       HEX.  Use #nn for decimal.

                See DU.DOC for complete examples.


Positioning:

Keepinç  "track¢  (literally!©  oæ wherå youò arå oî  á  disë  ió 
indicateä bù á terså displaù (e.g.¬  G=009C:04¬ T=43¬ S=5¬ PS=4)®  

Tï  besô  illustratå thå displaù (anä mosô importantly¬  whaô  iô 
means)¬ jusô enteò thå followinç command:

:+;/<cr> <-- advance to the next sector and repeat forever...

Anä  thå  Group¬  Track¬  Logicaì  Sector¬  anä  Physicaì  sectoò 
"assignments¢  wilì  incrementallù bå displayeä foò  youò  entirå 
disë  continuouslù  (uså  ^Ã tï quit)®   Thå  "meaning¢  (anä  aî 
examplå display©, ió aó follows:
Š     .-- Group Allocation Number
     |  .-- Sector Block Number (always 128 bytes)     
     |  |     .-- Physical Track     
     |  |     |    .-- Logical Sector
     |  |     |    |     .-- Physical Sector  
     |  |     |    |     |
G=009C:01, T=43, S=2, PS=1
G=009C:02, T=43, S=3, PS=2
G=009C:03, T=43, S=4, PS=3
G=009C:04, T=43, S=5, PS=4
G=009C:05, T=43, S=6, PS=5
G=009C:06, T=43, S=7, PS=6
G=009C:07, T=43, S=8, PS=7
G=009C:08, T=43, S=9, PS=24
G=009C:09, T=43, S=10, PS=25
G=009C:0A, T=43, S=11, PS=26
G=009C:0B, T=43, S=12, PS=27
G=009C:0C, T=43, S=13, PS=28
G=009C:0D, T=43, S=14, PS=29
G=009C:0E, T=43, S=15, PS=30
G=009C:0F, T=43, S=16, PS=31 <-- end of 2K Group Number 009C
G=009D:00¬ T=43¬ S=17¬ PS=4¸ <-- á ne÷ Grouð Allocatioî numbeò starts
G=009D:01, T=43, S=18, PS=49     after Sector Block Number 16 (0F HEX)
þ                          þ     (buô maù bå differenô foò YOUÒ DISK!)
|     etc., etc., etc.,    |


Positioninç therefore¬  ió donå bù Grouð (Gnn)¬  Tracë (Tnn)¬  oò 
Sector (Snn) movement commands as follows:

	Gnn	By allocation group.  Example:

                :g0<cr>
                G=0000:00, T=4, S=1, PS=0

	Tnn	By track.

	Snn	By sector.

	+nn	Move ahead nn sectors.

	-nn	Move back nn sectors.


I/O:

	R	Reads sector.

	W	Writes sector.

	<	Puts current sector "away" into a buffer.

	>	Recalls previously saved sector.

ŠDisplaying:

	G	Shows current group, track, sector.

	M	Maps the disk (file group allocations).
     	  or,
	Mxx	Map starting at group xx

	D	Dump the sector (Hexadecimal and ASCII display).

	A	Dump sector in ASCII.

	H	Dump sector in hexadecimal.

	Vnn	Views (like CP/M TYPE) nn sectors.

	#	Shows disk parameters, also the number of sectors
		stacked and used via '<<' and '>>'. Example:

                :#<cr>
                Disk Information:
                Tracks:         154
                Sec/trk:        64
                Grpsize:        16 (sectors per group)
                Tot grps:       599
                Dir entries:    256
                Sys tracks:     4


Changing:

	CHnn,val Change data in hexadecimal.

	CAnn,vaì Changå datá iî ASCIÉ ¨ witè <xx¾ escapå tï hexadecimal).

	N	Insert new disk.

	Unn	Change user directory number to nn.


Searching:

	Fname	Find a file in the directory.

	F	Find next occurrence (extent) of same name.

	=aaaa	Scan for aaaa (in ASCII) from current sector on.


Miscellaneous:

	Znn	Sleep (nn tenths of a second) such as to allow
		viewing data before it scrolls off.

	Lx	Log in disk x.Š
	P	Turn on/off printer output toggle.

	Q	Before any command does it "quietly".

	X	Exit to CP/M.

	/nî	Repeaô previouó commanä nî timeó (indefinitelù iæ nî omitted).

2.2 Alphabetic Command Summary


	#	Prints the disk parameters.

	+	Advance 1 sector (if below track 2,
		this advances to next numerical, if
		2 or greater, advances based on CP/M's normal
		sector scrambling algorithm, i.e. so '+'
		will get the next logical sector of the file).

	-	Backs up 1 logical sector.

		Note + and - may take an amount:
		for example, +15 steps in 15 sectors.

	/	Repeats entire command.  Defaults to "forever".
           or,
	/nn	nn may be 2 to 65,535.

	<	Saves current sector in a save buffer, and
		also resets buffer pointer used by '<<' and '>>'.

	<<	Saves current sector, bumps memory pointer.
		Thus subsequent '<<' saves "next" buffer in
		memory.  Use '<' to reset, or '>>' to
		sequentially retrieve the buffers, such as to
		move several sectors from one place on disk
		to another, or to another disk, or just to
		memory (stored at 2000H where DDT can be used 
		to subsequently access them).

	=string	Ascii search, starting at current
		sector. <xx> hex may be imbedded,
		or used alone:  To find "IN 0FEH":
		=<db><fe><cr>

		Note: ignores bit 7 unless <xx> is used.

		Since ";" is a command delimiter, you
		have to use <3B> to search for a ";".
		
		Also, since "<" is a hex-escape character,
		use << to means a single "<".

		Also note that the special symbol "@" containsŠ		the displacement at which the match occurred.
		It may thus be subsequently used in a 'C'
		command, as in:

			=LIX;CA@,LXI;W<cr>

		would search for the string LIX, change
		it to an LXI, and write it back.


	>	Gets saved buffer.  '<' and '>' may be used
		to move a sector to another place.

	>>	Restore "oldest" unrestored sector saved
		by '<<' command.  This command may be
		"buried" in the middle of an infinite
		repeat '/', because it will stop operating
		when there are no more sectors in the buffer.

	?	Gives command summary.

	A	Dump sector, ASCII only.

	CHaddr,val,val,val... change hexadecimal in sector.

	CAaddr,char string... change ASCII in sector. '<xx>'
                 may be hex imbedded in the ASCII: ca0,OK<d><a><1a>

		Note: use 'W' to write changes to disk. The 'C'
                "echoes" overlaid data for verification.

	CHaddr-addr,byte
          or,
	CAaddr-addr,byte	Repeats a change.

	D	Dump sector, hexadecimal and ASCII.

	Fname	print directory for file "name",
		then positions to it's directory
		sector.

	F	Find next occurrence of name in the directory.

	Gnn	Position to group nn and read.

	G	Shows current position.

	H	Dump sector, hexadecimal only.

	L	Re-logs in the current disk. You may pull
		out a disk, put in a new, and "L" just
		to log it in. (See "LOGGING IN DISK" in NOTES
		below)

	Lx	Logs in disk 'x', such as: LB<cr>Š
	M	Dumps a map of the group allocations
		for files.
          or,
	Mn	Shows which file is allocated to
		group "n".


	N	Resets CP/M via the BDOS.  This may
		make it possible under some implementations
		of CP/M to change the disk format (e.g., density,
		sides, etc).

	P	Toggle printer switch on/off.

	Q	Quiet: Preceeding any command, suppresses console
		output.

	R	Reads the sector currently positioned to
		into memory.  Note: 'R' (Read) is implicit in
		the 'G', '+', and '-' commands, but NOT in the
		'S' and 'T' commands.

	Snn	Position to sector nn, and read.

	Tnn	Seek to track nn (no read).

	Uø	Logó useò 'x§ foò nexô Æ command® Displays thå character
		'?' error if not CP/M-80 version 2.0 (or greater).

	V	Views the current sector (assumes ASCII data).

	Vnn	Views nn sectors.

	W	Write back the current sector. Note: may
		not be used after an F command, as CP/M was
		used to find the file in the directory.

	X	Exit back to CP/M (Must press return).

	Z	Sleep - causes the program to pause, such
		as to look at a dump.  'Z' is 1 second.  Znn
		is nn tenths of a second on a 2 MHz 8080 CPU.


3.0 Usage Notes

3.1 Multiple Commands: May be separated by ";"

Exampleº  thå followinç commandó wilì eraså thå Bº disë directorù 
          tï alì E5's:

	lb<cr>		"Log-in" (select) the 'B:' drive.
	g0<cr>		Position to the start of the directory.
	ch0-7f,e5<cr>	Fill with the value 'E5' hexadecimal.Š	<<cr>		Save the sector
	>;w;+;/16<cr>	Restore, write, next repeat 16 times.

This could be shortened to:

	lb;g0;ch0-7f,e5;<<cr>
	>;w;+;/16<cr>


3.² Dumð Commandó - Alì dumð commandó (D¬ A¬ H© maù bå optionallù 
followeä bù á startinç anä endinç address:

	D0,7F<cr>	...is the same as just D<cr>
	D3,5<cr>
	A20,3F<cr>

3.³  Logginç iî Disk‚ - Somå problemó maù ariså wheî  "logging-in¢ 
disketteó witè "mixed-density¢ (i.e.¬ Tracë 0° ió singlå density¬ 
anä  thå directorù trackó arå doublå density¬  alá IBÍ Systeí  3´ 
typå disks)®   Á solutioî ió tï loç iî á disë whicè ió OK¬ anä ió 
oæ  thå  samå  densitù aó thå disë thaô yoõ wanô tï  examinå  anä 
alter¬ theî puô iî thå ne÷ disë WITHOUÔ logginç iô in.

However¬  yoõ  arå no÷ openinç yourselæ uð tï  possiblå  problemó 
becauså  oæ thå bufferinç oæ physicaì sectoró iî thå  BIOS®   Thå 
besô  technique¬  (buô noô guaranteed)¬  woulä bå tï seeë tï  thå 
unuseä inneò trackó oæ thå firsô disk¬  dï thå read¬  THEÎ changå 
disks®   Thaô waù iæ iô writeó anything¬ yoõ won'ô havå destroyeä 
anything...assuminç  thå disë ió noô  completelù  full®   Anotheò 
technique¬  assuminç  thå  seconä  disë doeó noô contaiî  á  CP/Í 
system¬  woulä bå tï seeë tï Tracë 1¬ theî dï thå reaä there¬ anä 
theî changå diskó tï thå new one.


3.´  Sectoò  Bufferó  (Thå '<<§ anä '>>§ commands)‚  - Uð  tï  25µ 
sectoró (onlù becauså itó á ± bytå counter© maù bå saveä bù '<<'®  
ANÙ TIMÅ '<§ ió executed¬ thå bufferó arå "throwî away"® Onå '>>§ 
tï fetcè á saveä buffeò anä makå iô availablå foò writing¬ maù bå 
issueä foò eacè previouó '<<'®   Thå 'M§ (directorù map©  commanä 
useó  aî  areá  oæ memorù foò á  buffer®   Tï  minimizå  problemó 
(caveaô  programmer)¬  thå MAÐ buffeò ió placeä á thå ENÄ oæ  thå 
CURRENTLÙ HIGHESÔ USEÄ '<<§ buffer®  Oî smalì systems¬ wherå manù 
bufferó  havå beeî saveä viá '<<'¬  thå 'M§ commanä mighô  reporô 
thaô  iô raî ouô oæ memory®   Executinç '<§ oò '>>§ á  sufficienô 
numbeò  oæ timeó foò iô tï telì yoõ therå arå nï morå sectoró  iî 
thå  buffer¬  wilì theî makå rooí availablå iî memorù aô á  loweò 
address®  Theî 'M§ maù bå useä foò "mapping¢ thå directory.


4.0 Interpreting CP/M Directory Data

4.1 Single Density

Thå  followinç  explainó thå formaô oæ á CP/Í directorù entrù  aó 
showî bù DU¬  usinç eitheò thå 'F' (finä file© command¬  oò  jusô Šdoinç  'D' (dump© oæ thå directorù sectors¬  whicè arå locateä iî 
groupó ° anä ± oî á singlå densitù disk.

Sample result of 'fSID.COM' (find 'SID.COM') command:

40  00534944 20202020  20434F4D 0000003A  *.SID     COM...:*
50  33343536 3738393A  00000000 00000000  *3456789:........*

First line -

40  00534944 20202020  20434F4D 0000003A  *.SID     COM...:*
||  |||                      |  ||    ||    |         |
||  ||^----HEX File Name-----^  ||    ||    ^File Name^
||  ||                          ||    ||     in ASCII
||  ||                   Extent-^^    ||
||  ||                                ||
||  ||           File Size in Sectors-^^
||  ||
||  ^^-00 = File Active (other values (e.g., 03 = User Number 3)
||     E5 = File Erased
^^-Displacement of the "line" (16 entries/line) in the directory sector

Noteº  foò  thå  newcomeò  tï  "CP/Í  jargon"¬  á  filå  'extent§ 
(actuallù thå extensioî oæ á file© indicateó tï thå CP/Í BDOÓ thå 
numbeò oæ 1¶ thousanä (16K© consecutivå byteó containeä withiî  á 
file®   Extentó arå numbereä froí ° tï 31® Onå extenô maù contaiî 
1¬  2¬  4¬  4¬  ¸ oò 1¶ blockó (á block¬  ió á basiã uniô oæ disë 
spacå allocation¬  anä maù bå 1K¬  2K¬  4K¬ 8Ë oò 16Ë consecutivå 
bytes)®   Theså blockó theî arå assigneä grouð numberó (á "group¢ 
ió  á  grouð oæ disë sectors)¬  anä arå allocateä dynamicallù  tï 
accomodatå thå requireä disë spacå oî á disk¬  aó useä bù á giveî 
filå  (Grouð  °  ió ALWAYÓ thå starô  oæ  thå  directorù  group)®  
Therefore¬ á filå "name¢ mighô appeaò iî thå directoò á numbeò oæ 
timeó  ¬  dependinç  oî  thå  numbeò oæ  extensionó  requireä  tï 
accomodatå  thå  fileó sizå (refeò tï thå samplå  disë  "MAP¢  iî 
sectioî   2.°   Usage...thå   filå   PBIOS.ASÍ   showó   multiplå 
extents)...Whew¡ Witè thaô ouô oæ thå waù then¬ É hopå thió makeó 
sense:

Second line -

50  33343536 3738393A  00000000 00000000  *3456789:........*
    |				       |   |
    |				       |   ^- The allocation groups
    ^-----Allocation Group Numbers-----^      that just happened
					      to be printable!

4.2 Double Density

Thå followinç ió á samplå oæ  SID.COÍ runninç oî á doublå densitù 
system:

:fSID.COM<cr> <-- Find 'SID.COM' on the disk...
00  00534944 20202020  20434F4D 0000003A  *.SID     COM...:*
10  38003900 3A003B00  00000000 00000000  *8.9.:.;.........*ŠG=0000:00, T=2, S=1, PS=0

Thå  primarù  differencå ió thaô thå groupó no÷ occupù  ²  bytes¬ 
i.e®  "3¸  00"¬  "3¹ 00"¬  etc®   Thió followó thå INTEÌ anä CP/Í 
conventioî  oæ puttinç 1¶ biô valueó  high-byte-first®   Thuó  iô 
meanó grouð 0038¬ 0039¬ etc.

Notå thaô iî doublå density¬  eacè grouð stooä foò 2K¬ noô 1K¬ sï 
therå werå halæ aó manù groupó foò thå samå file.

Bå  VERÙ carefuì wheî patchinç á directorù undeò doublå  density®  
É oncå madå thå mistakå oæ putting¬ foò example:

	ch10,38,39,3a,3b...

Wheî  É wenô tï reaä thió file¬  iô trieä tï accesó  grouð  3938¬ 
witè  resultanô  angrù exclamationó froí thå disë steppeò  aó  iô 
attempteä tï gï soutè tï Peoriá foò thå data.

5.0 DU Usage Examples

5.1 Erased Program Recovery

Let'ó  supposå thaô yoõ havå jusô puô oî thå "finaì  touches¢  tï 
youò  latest'n'greateó  prograí tï markeô aó youò ne÷ "let'ó  geô 
pooò  quick¢ scheme...yoõ (oæ course© havå NEVEÒ madå  á  back-uð 
copù  afteò  havinç  puô iî 10^1¶ (thaô 1° tï  thå  16tè  power!© 
weekendó oæ timå intï it® Sï yoõ proudlù examinå thå directorù oæ 
youò pride-and-joy:

A0>dir b:
B: BIZ-INIT BAS : BIZ-CALC BAS : BIZ-CHRT BAS : BIZ-WIZ  TXT
B: BIZ-WIZ  BAS

Yep...Alì  there¬   and...(ring¬   ring...itó  thå  #%&"*«  phonå 
again!)®  O.K® bå bacë iî á fe÷ minuteó anä geô á printeò listinç 
foò posterity...(tick¬ tick...minuteó turî tï hours...):

Aè yes¬  letó seå wherå waó I¿  Oè yes¬ thaô guù calleä aî wanteä 
tï  modeí oveò hió latesô versioî oæ FOOBAR...Fine¬  betteò  makå 
some room on this "scratch disk" in the B: drive...so we:

A>era b:*.* <-- lets just get rid of whatever junk is there...
ALÌ (Y/N)?ù <-- sure¬  iæ  É can'ô remembeò wható there¬ can'ô bå important!

A0>dir b: <-- and just to be sure...
NO FILE <-- Yep! No files left...but...AAaarrgghh! The wrong $&+#* disk!!!


                      What do you do,... what do you do???

Do you...D You....Dee U.....ahh Hah! DU!!! Disk Utility to the rescue!

É  jusô  KNE× somethinç cleveò woulä (eventually© emergå froí  mù 
beer-foggeä brain to save my ASCII (err, ahh)...so here I go!Š
A0>du<cr>

DISK UTILITY ver 7.7
Universal Version

Type ? for help
Type X to exit

:lb<cr> <-- "log" disk B: (forest reclamation project!)

:g0;d<cr> <-- Go to Group 0 (always the directory group) and Dump:
G=00:00, T=2, S=1, PS=1
00  E542495A 2D494E49  54424153 0000001C  *eBIZ-INITBAS....*
10  02030405 00000000  00000000 00000000  *................*
20  E542495A 2D43414C  43424153 00000050  *eBIZ-CALCBAS...P*
30  06070809 0A0B0C0D  0E0F0000 00000000  *................*
40  E542495A 2D434852  54424153 00000019  *eBIZ-CHRTBAS....*
50  10111213 00000000  00000000 00000000  *................*
60  E542495A 2D57495A  20545854 00000029  *eBIZ-WIZ TXT...)*
70  14151617 18190000  00000000 00000000  *................*

Hmmm...mù   fileó  alrighô  witè  funnù  littlå  "e's¢  iî  fronô 
of'em...lets also look at the next directory sector:

:+;d<cr> <-- advance +1 sector and Dump it also:
G=00:01, T=2, S=2, PS=7
00  E542495A 2D57495A  20424153 00000080  *eBIZ-WIZ BAS....*
10  1A1B1C1D 1E1F2021  22232425 26272829  *...... !"#$%&'()*
20  E542495A 2D57495A  20424153 0100006B  *eBIZ-WIZ BAS...k*
30  2A2B2C2D 2E2F3031  32333435 36370000  **+,-./01234567..*
40  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
50  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
60  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
70  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*

Well¬  itó  alì  sittinç therå (sort'a!© iî thå  directory...letó 
backuð  onå sector¬  anä starô fixinç thingó uð tï recoveò  thoså 
eraseä files:

:-<cr> <-- minus 1 sector...
G=00:00, T=2, S=1, PS=1

:ch0,0;ch20,0;ch40,0;ch60,0<cr> <-- CHange all "E5's" to zeros:
E5E5E5E5 <-- the "E5's" (erased file flags) evaporate before our very eyes!
:d<cr> <-- Dump it just to check...
00  0042495A 2D494E49  54424153 0000001C  *.BIZ-INITBAS....*
10  02030405 00000000  00000000 00000000  *................*
20  0042495A 2D43414C  43424153 00000050  *.BIZ-CALCBAS...P*
30  06070809 0A0B0C0D  0E0F0000 00000000  *................*
40  0042495A 2D434852  54424153 00000019  *.BIZ-CHRTBAS....*
50  10111213 00000000  00000000 00000000  *................*
60  0042495A 2D57495A  20545854 00000029  *.BIZ-WIZ TXT...)*
70  14151617 18190000  00000000 00000000  *................*
Š:w<cr> <--Write this directory sector back to the disk:

:+<cr> <-- advance to the next directory sector:
G=00:01, T=2, S=2, PS=7

:d<cr> <-- Dump it also, to be sure...
00  E542495A 2D57495A  20424153 00000080  *eBIZ-WIZ BAS....*
10  1A1B1C1D 1E1F2021  22232425 26272829  *...... !"#$%&'()*
20  E542495A 2D57495A  20424153 0100006B  *eBIZ-WIZ BAS...k*
30  2A2B2C2D 2E2F3031  32333435 36370000  **+,-./01234567..*
40  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
50  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
60  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
70  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*

:ch0,0;ch20,0<cr>‚ <-- jusô CHangå foò thå twï directorù entries...
E5E5

:d<cr> <-- why "valley girls" take 2 birth control pills (to be sure, fer'sure!)
00  0042495A 2D57495A  20424153 00000080  *.BIZ-WIZ BAS....*
10  1A1B1C1D 1E1F2021  22232425 26272829  *...... !"#$%&'()*
20  0042495A 2D57495A  20424153 0100006B  *.BIZ-WIZ BAS...k*
30  2A2B2C2D 2E2F3031  32333435 36370000  **+,-./01234567..*
40  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
50  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
60  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*
70  E5E5E5E5 E5E5E5E5  E5E5E5E5 E5E5E5E5  *eeeeeeeeeeeeeeee*

:w<cr> <-- Write this directory sector as well, before we quit!

:x<cr> <-- eXit to CP/M-80...

A0>dir b:<cr> <-- and as if by magic...
B: BIZ-INIT BAS : BIZ-CALC BAS : BIZ-CHRT BAS : BIZ-WIZ  TXT
B: BIZ-WIZ  BAS
A0>...It's all done with mirrors!

5.2 Modifying a disk for "Program Autoload"

Bù  modifyinç  á portioî oæ thå CP/Í operatinç  system¬  yoõ  caî 
forcå iô loaä automaticallù anä executå á commanä file®  Thió caî 
bå  particularlù usefuì iæ yoõ wanô tï set-uð somå fancù  printeò 
initialization¬  modifù somå seriaì porô Bauä ratå oò datá formaô 
parameters¬  etc®  Tï  enteò  aî  "autoload¢ filenamå tï  á  CP/Í 
diskette:

:t2;s1;d<cr>‚ <-- positioî tï Tracë 2¬ Sectoò 1¬ anä Dump...
 T=2, S=1, PS=0      (NOTE: this is representative of my disk only!)
 T=2, S=1, PS=0
00  C35CDDC3 58DD7F00  20202020 20202020  *C\]CX]..        *
10  20202020 20202020  434F5059 52494748  *        COPYRIGH*
20  54202843 29203139  37392C20 44494749  *T (C) 1979, DIGI*
30  54414C20 52455345  41524348 20200000  *TAL RESEARCH  ..*
40  00000000 00000000  00000000 00000000  *................*
50  00000000 00000000  00000000 00000000  *................*Š60  00000000 00000000  00000000 00000000  *................*
70  00000000 00000000  00000000 00000000  *................*
          
:ca8,SIGNON<0><cr> <-- Change ASCII, address 8 to 'SIGNON' and '0'.
                 
:ch7,6<cr>‚ <-- Changå Hex, addresó · tï á valuå oæ ¶ (length byte)
00            <-- what the value "was" prior to the change
:d<cr>     <-- Dump the disk sector for display
00  C35CDDC3 58DD7F06  5349474E 4F4E0020  *C\]CX]..SIGNON. *
10  20202020 20202020  434F5059 52494748  *        COPYRIGH*
20  54202843 29203139  37392C20 44494749  *T (C) 1979, DIGI*
30  54414C20 52455345  41524348 20200000  *TAL RESEARCH  ..*
40  00000000 00000000  00000000 00000000  *................*
50  00000000 00000000  00000000 00000000  *................*
60  00000000 00000000  00000000 00000000  *................*
70  00000000 00000000  00000000 00000000  *................*
          
:w<cr> <-- Write the disk sector.
:x<cr> <-- eXit to CP/M.

Yoõ  coulä  no÷  "colä  boot¢  thió  CP/M-8°  systeí  disk¬   anä           
iô   woulä   "autoload¢   bù   runninç   thå   'SIGNON§   prograí           
(whateveò thaô is!© prioò tï doinç anythinç else.

5.3 Finding and Modifying Program Data Quickly

Thió examplå sho÷ ho÷ tï finä á filenamå iî thå  directory¬  theî 
locatå  thå datá withiî thå filå foò subsequenô modificatioî  (iî 
thió caså jusô tï changå á versioî numbeò iî thå sourcå code...wå 
could (I suppose) have used (barf...) 'ED'!):

:fSYSTOSYS.ASM<cr> <-- Find the program 'SYSTOSYS.ASM'
20  00535953 544F5359  5341534D 00000080  *.SYSTOSYSASM....*
30  0E010F01 10011401  15011601 4F015001  *............O.P.*
G=0000:00, T=4, S=1, PS=0

:g10e<cr>‚ <-- Gï tï Grouð '10E§ (seå iô abovå aô addresó 3° anä 31? Also,
G=010E:00¬ T=71¬ S=33¬ PS=3²         remembeò tï enteò 2Ë groupó "bas-akwards¢ 
                                     froí whaô yoõ see. In this case NOT E01!)
:d<cr> <-- Dump it...
00  3B202020 20202020  20202020 20202020  *;               *
10  436F6D70 7570726F  20382F31 3620436F  *Compupro 8/16 Co*
20  6D706174 69626C65  20535953 544F5359  *mpatible SYSTOSY*
30  53205665 7273696F  6E20312E 340D0A3B  *S Version 1.4..;*
40  20202020 20202020  20202020 20202043  *               C*
50  6F707972 69676874  20284329 20313938  *opyright (C) 198*
60  312C2031 3938322C  20313938 33206279  *1, 1982, 1983 by*
70  204B656C 6C792053  6D697468 0D0A3B0D  * Kelly Smith..;.*

:ca3c,5<cr> <-- I want to change from version 1.4 to 1.5:
4
:d<cr> <-- what sound does the Lone Rangers horse make? (Dump'ta'da'Dump'ta'da...)
00  3B202020 20202020  20202020 20202020  *;               *
10  436F6D70 7570726F  20382F31 3620436F  *Compupro 8/16 Co*
20  6D706174 69626C65  20535953 544F5359  *mpatible SYSTOSY*Š30  53205665 7273696F  6E20312E 350D0A3B  *S Version 1.5..;*
40  20202020 20202020  20202020 20202043  *               C*
50  6F707972 69676874  20284329 20313938  *opyright (C) 198*
60  312C2031 3938322C  20313938 33206279  *1, 1982, 1983 by*
70  204B656C 6C792053  6D697468 0D0A3B0D  * Kelly Smith..;.*

:w<cr> <-- Write it...

:x<cr> <-- Do with me what you will (just don't leave me unsatisfied!)

A>Ahhhhh...thats better!

5.4 A "Poor Man's" Disk Test

DÕ  caî alsï functioî iî thå capacitù oæ á "Pooò Man's¢ disë tesô 
bù  performinç simplå sequentiaì write/read/seeë  functionó  witè 
useò specifieä datá patterns®   Herå iî verù simplå form¬  ió á ´ 
sectoò  non-destructivå  read-only/seeë  tesô.  Anù   susbsequenô 
erroró woulä bå trappeä bù thå CP/Í BDOÓ anä stoð thå "test¢ witè 
whateveò erroò messagå waó appropriatå (e.g.¬  BDOÓ Erò oî Bº BAÄ 
SECTOR):

:t20;s1<cr>
G=0040:00, T=20, S=1, PS=0

:+;+;+;+;-;-;-;-;/<cr> <-- read forward 4 sector,
G=0040:01, T=20, S=2, PS=1     read backward 4 sectors,
G=0040:02, T=20, S=3, PS=2     repeat 'ad nauseum' (actually until ^C)
G=0040:03, T=20, S=4, PS=3
G=0040:04, T=20, S=5, PS=4
G=0040:03, T=20, S=4, PS=3
G=0040:02, T=20, S=3, PS=2
G=0040:01, T=20, S=2, PS=1
G=0040:00, T=20, S=1, PS=0
G=0040:01, T=20, S=2, PS=1
G=0040:02, T=20, S=3, PS=2
G=0040:03, T=20, S=4, PS=3
G=0040:04, T=20, S=5, PS=4
G=0040:03, T=20, S=4, PS=3
~                        ~
| days or weeks later... |
~                        ~
G=0040:03, T=20, S=4, PS=3
G=0040:02, T=20, S=3, PS=2
G=0040:01, T=20, S=2, PS=1
G=0040:00, T=20, S=1, PS=0
G=0040:01, <-- interrupted with ^C from the keyboard.
:

Bù  usinç  youò imagination¬  yoõ caî come-uð witè á  varietù  oæ 
usefull applications for DU...Have fun!
